shithub: sox

Download patch

ref: f687e4a7051669bc7c962dd9cce78f4a2690c2b5
parent: a540717a81d810ec03ea64d2ab7ea035f334c036
author: cbagwell <cbagwell>
date: Thu Jan 18 10:09:55 EST 2001

Bug fix to new avg effect.

--- a/src/avg.c
+++ b/src/avg.c
@@ -364,9 +364,9 @@
 	
 	ichan = effp->ininfo.channels;
 	ochan = effp->outinfo.channels;
-	len = *isamp;
-	if (len > *osamp)
-		len = *osamp;
+	len = *isamp / ichan;
+	if (len > *osamp / ochan)
+		len = *osamp / ochan;
 	for (done = 0; done < len; done++, ibuf += ichan, obuf += ochan) {
 		for (j = 0; j < ochan; j++) {
 			samp = 0.0;
@@ -379,8 +379,8 @@
 			obuf[j] = samp;
 		}
 	}
-	*isamp = len;
-	*osamp = len;
+	*isamp = len * ichan;
+	*osamp = len * ochan;
 	return (ST_SUCCESS);
 }