shithub: sox

Download patch

ref: 8f62fe4772bbb84690c4dba9ccf8c97b556e4509
parent: d6aaca5ad6b6cb27dc6501c31af7b96c12f813e5
author: rrt <rrt>
date: Wed Dec 27 13:36:06 EST 2006

rabbit and repeat cope quite happily with working idempotently.

--- a/src/rabbit.c
+++ b/src/rabbit.c
@@ -88,9 +88,6 @@
   double in_rate = floor(effp->ininfo.rate / effp->globalinfo->speed + .5)
     * effp->globalinfo->speed; /* FIXME: Make "speed" more accurate (st_rate_t is int) */
 
-  if (effp->ininfo.rate == effp->outinfo.rate)
-    return ST_EFF_NULL;
-
   if (effp->ininfo.channels != effp->outinfo.channels) {
     st_fail("number of Input and Output channels must be equal to use rabbit effect");
     return ST_EOF;
--- a/src/repeat.c
+++ b/src/repeat.c
@@ -59,9 +59,6 @@
 {
         repeat_t repeat = (repeat_t)effp->priv;
 
-        if (repeat->repeats == 0)
-          return ST_EFF_NULL;
-
         if ((repeat->fp = tmpfile()) == NULL) {
                 st_fail("repeat: could not create temporary file");
                 return (ST_EOF);
@@ -118,8 +115,7 @@
                 if (repeat->repeats == 0) {
                         *osamp = 0;
                         return (ST_EOF);
-                }
-                else {
+                } else {
                         repeat->repeats--;
                         fseeko(repeat->fp, 0L, SEEK_SET);
                         repeat->remaining = repeat->total;
@@ -133,7 +129,7 @@
                                 repeat->fp);
                 if (read != samp) {
                         perror(strerror(errno));
-                        st_fail("repeat1: read error on temporary file");
+                        st_fail("repeat: read error on temporary file");
                         return(ST_EOF);
                 }
 
@@ -147,12 +143,10 @@
 
                         if (repeat->total >= *osamp - done) {
                                 samp = *osamp - done;
-                        }
-                        else {
+                        } else {
                                 samp = repeat->total;
-                                if (samp > *osamp - done) {
+                                if (samp > *osamp - done)
                                         samp = *osamp - done;
-                                }
                         }
 
                         repeat->remaining = repeat->total - samp;
@@ -167,9 +161,8 @@
                         }
 
                         done += samp;
-                        if (done == *osamp) {
+                        if (done == *osamp)
                                 break;
-                        }
                 }
                 *osamp = done;
         }