shithub: sox

Download patch

ref: 47a2524286f71160f89b7b7f527c176deec569a9
parent: 1c64d8c6e40dfcef48b795fd4825bc3fe9defccd
author: Ulrich Klauer <ulrich@chirlu.de>
date: Fri Dec 23 18:45:40 EST 2011

Warn (instead of failing) when non-analysis effects follow dither

Allow effects that modify the audio after "dither" (albeit with a
warning), as this is useful for experimental purposes such as
amplifying and listening to the quantization noise.

Also propagate the output precision of the dither effect to
out_signal.precision.

--- a/src/dither.c
+++ b/src/dither.c
@@ -359,7 +359,7 @@
 
   if (effp->in_signal.precision <= p->prec || p->prec > 24)
     return SOX_EFF_NULL;   /* Dithering not needed at this resolution */
-  effp->out_signal.precision = effp->in_signal.precision;
+  effp->out_signal.precision = p->prec;
 
   p->flow = flow_no_shape;
   if (p->filter_name) {
--- a/src/sox.c
+++ b/src/sox.c
@@ -674,9 +674,10 @@
     }
     break;
     case 2: if (!(effp->handler.flags & SOX_EFF_MODIFY)) {
-      lsx_fail("effects that modify audio must not follow dither");
-      exit(1);
+      lsx_warn("%s: effects that modify audio should not follow dither",
+        effp->handler.name);
     }
+    break;
   }
   return sox_add_effect(chain, effp, in, out);
 }