shithub: sox

Download patch

ref: 1c3d5239c706baeaf036a9e628fd78744e0efd8d
parent: 195e1bf4518685cdf635d8b58b3c9ccf66bad942
author: Rob Sykes <robs@users.sourceforge.net>
date: Wed Oct 29 16:51:57 EDT 2014

prevent division by 0 when input signal is entirely non-negative, non-positive, or both

--- a/src/gain.c
+++ b/src/gain.c
@@ -80,7 +80,9 @@
     if (!p->do_equalise && !p->do_balance && !p->do_balance_no_clip)
       effp->flows = 1; /* essentially a conditional SOX_EFF_MCHAN */
   }
-  p->mult = p->max = p->min = 0;
+  p->mult = 0;
+  p->max = 1;
+  p->min = -1;
   if (p->do_scan) {
     p->tmp_file = lsx_tmpfile();
     if (p->tmp_file == NULL) {