shithub: sox

Download patch

ref: 90dfe0bb878eef192c703f1759f57777a0870922
parent: 7765a3215eadbb56ca67429b93538dfc559cbd12
author: robs <robs>
date: Wed Feb 20 05:05:39 EST 2008

vol is really annoying, as unlike every other effect, it doesn't use dBs
by default

--- a/src/effects.h
+++ b/src/effects.h
@@ -17,6 +17,7 @@
   EFFECT(fade)
   EFFECT(filter)
   EFFECT(flanger)
+  EFFECT(gain)
   EFFECT(highpass)
   EFFECT(key)
 #ifdef HAVE_LADSPA_H
--- a/src/vol.c
+++ b/src/vol.c
@@ -183,3 +183,23 @@
   };
   return &handler;
 }
+
+static int gain_getopts(sox_effect_t * effp, int argc, char * * argv) 
+{
+  char * args[] = {0, "dB"};
+
+  if (argc != 1)
+    return sox_usage(effp);
+  args[0] = argv[0];
+  return sox_vol_effect_fn()->getopts(effp, array_length(args), args);
+}
+
+sox_effect_handler_t const * sox_gain_effect_fn(void)
+{
+  static sox_effect_handler_t handler;
+  handler = *sox_vol_effect_fn();
+  handler.name = "gain";
+  handler.usage = "dB-gain";
+  handler.getopts = gain_getopts;
+  return &handler;
+}