shithub: sox

Download patch

ref: 19122d5ba7476b1ab747119a2717f51eb597dc02
parent: 1adc35cd997bb4c5165462e74871593f228cdcf7
author: robs <robs>
date: Thu Oct 18 14:59:42 EDT 2007

Fix [bug #1804772] Reverb effect locks up

--- a/ChangeLog
+++ b/ChangeLog
@@ -14,7 +14,8 @@
 
   Bug fixes:
 
-  o Fix Sndtool read error causing noise at start.  (Reynir Stefansson)
+  o Fix Sndtool read error causing noise at start.  (Reynir Stefánsson)
+  o Fix [bug #1804772] Reverb effect locks up.  (Reynir Stefánsson)
   o Fix loss of 1 decoded FLAC block when using "trim 0 ...".  (robs)
   o Let "make distcheck" run some automated test scripts.
   o Distribute missing cmake files.
--- a/src/reverb.c
+++ b/src/reverb.c
@@ -238,6 +238,7 @@
         sox_ssample_t out, l;
         size_t i, j;
         sox_size_t done;
+        sox_bool notfaded;
 
         i = reverb->counter;
         done = 0;
@@ -256,13 +257,12 @@
                 reverb->pppl = reverb->ppl;
                 reverb->ppl = reverb->pl;
                 reverb->pl = l;
-                i++;            /* need a % maxsamples here ? */
-                i %= reverb->maxsamples;
-        } while((done < *osamp) && 
-                ((abs(reverb->pl) + abs(reverb->ppl) + abs(reverb->pppl)) > REVERB_FADE_THRESH));
+                i = (i + 1) % reverb->maxsamples;
+                notfaded = (abs(reverb->pl) + abs(reverb->ppl) + abs(reverb->pppl) > REVERB_FADE_THRESH);
+        } while (done < *osamp && notfaded);
         reverb->counter = i;
         *osamp = done;
-        return (SOX_SUCCESS);
+        return notfaded? SOX_SUCCESS : SOX_EOF;
 }
 
 /*