shithub: sox

Download patch

ref: 1b48206ecf97b974de54ca01378d2706ce92953c
parent: 836eb61b9c5fc186465ff4a9d2a4d097c7339a8d
author: Ulrich Klauer <ulrich@chirlu.de>
date: Fri Jan 13 17:05:18 EST 2012

Feed only complete wide samples to MCHAN effects

Make sure that SOX_EFF_MCHAN effects only receive blocks of samples
whose length is divisible by the number of channels, so they aren't
tempted to process parts of wide samples.

--- a/src/effects.c
+++ b/src/effects.c
@@ -221,10 +221,11 @@
   size_t pre_odone = obeg;
 #endif
 
-  if (effp->flows == 1)       /* Run effect on all channels at once */
+  if (effp->flows == 1) {     /* Run effect on all channels at once */
+    idone -= idone % effp->in_signal.channels;
     effstatus = effp->handler.flow(effp, &effp1->obuf[effp1->obeg],
                                    &effp->obuf[effp->oend], &idone, &obeg);
-  else {                 /* Run effect on each channel individually */
+  } else {               /* Run effect on each channel individually */
     sox_sample_t *obuf = &effp->obuf[effp->oend];
     size_t idone_last = 0, odone_last = 0; /* Initialised to prevent warning */