shithub: sox

Download patch

ref: e43b4954fe1432442b0716bdc6e791117caca3e6
parent: bcdf8938cce06e4a5159d91223de9a92122e044e
author: robs <robs>
date: Sun Dec 17 05:28:58 EST 2006

Nullify effects when they've nothing to do.

--- a/src/fade.c
+++ b/src/fade.c
@@ -190,6 +190,9 @@
 
     st_debug("fade: in_start = %d in_stop = %d out_start = %d out_stop = %d", fade->in_start, fade->in_stop, fade->out_start, fade->out_stop);
 
+    if (fade->in_start == fade->in_stop && fade->out_start == fade->out_stop)
+      return ST_EFF_NULL;
+
     return(ST_SUCCESS);
 }
 
--- a/src/swap.c
+++ b/src/swap.c
@@ -65,6 +65,7 @@
 static int st_swap_start(eff_t effp)
 {
     swap_t swap = (swap_t) effp->priv;
+    int i;
 
     if (effp->outinfo.channels == 1)
     {
@@ -121,7 +122,11 @@
 
     }
 
-    return (ST_SUCCESS);
+    for (i = 0; i < (int)effp->outinfo.channels; ++i)
+      if (swap->order[i] != i)
+        return ST_SUCCESS;
+
+    return ST_EFF_NULL;
 }
 
 /*