shithub: sox

Download patch

ref: d620a0b062c274b13d609d25f99e0e9e488781ed
parent: 076b51a2764bfa33c67ef2ed7223ce63365e707f
author: Rob Sykes <robs@users.sourceforge.net>
date: Mon Apr 25 17:49:36 EDT 2011

fix some speexdsp warnings

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -144,6 +144,7 @@
 optional(HAVE_SNDFILE sndfile.h sndfile sf_open w64)
 optional(HAVE_SNDFILE sndfile.h sndfile sf_open xi)
 optional(HAVE_SNDFILE_1_0_12 sndfile.h sndfile sf_open_virtual caf)
+optional(HAVE_SPEEXDSP speex/speex_preprocess.h speexdsp speex_preprocess_run speexdsp)
 optional(HAVE_SUN_AUDIOIO_H sun/audioio.h c ioctl sunaudio)
 if (NOT HAVE_SUN_AUDIOIO_H)
   optional(HAVE_SYS_AUDIOIO_H sys/audioio.h c ioctl sunaudio)
--- a/src/speexdsp.c
+++ b/src/speexdsp.c
@@ -197,7 +197,7 @@
         goto Done;
     }
 
-    p->sps = speex_preprocess_state_init(p->buffer_end, effp->in_signal.rate);
+    p->sps = speex_preprocess_state_init((int)p->buffer_end, (int)(effp->in_signal.rate + .5));
     if (!p->sps)
     {
         lsx_fail("Failed to initialize preprocessor DSP.");
@@ -323,24 +323,27 @@
    * the 6 functions, then the function above can be deleted
    * and NULL used in place of the its name below.
    */
-    static sox_effect_handler_t sox_speexdsp_effect = {
-        "speexdsp",
-        "Uses the Speex DSP library to improve perceived sound quality.\n"
-        "If no options are specified, the -agc and -denoise features are enabled.\n"
-        "Options:\n"
-        "-agc [target_level]    Enable automatic gain control, and optionally specify a\n"
-        "                       target volume level from 1-100 (default is 100).\n"
-        "-denoise [max_dB]      Enable noise reduction, and optionally specify the max\n"
-        "                       attenuation (default is 15).\n"
-        "-dereverb              Enable reverb reduction.\n"
-        "-fps frames_per_second Specify the number of frames per second from 1-100\n"
-        "                       (default is 20).\n"
-        "-spf samples_per_frame Specify the number of samples per frame. Default is to\n"
-        "                       use the -fps setting.",
-        SOX_EFF_PREC | SOX_EFF_GAIN | SOX_EFF_ALPHA,
-        getopts, start, flow, drain, stop, NULL, sizeof(priv_t)
-    };
-  return &sox_speexdsp_effect;
+  static sox_effect_handler_t descriptor = {
+    "speexdsp", 0, SOX_EFF_PREC | SOX_EFF_GAIN | SOX_EFF_ALPHA,
+    getopts, start, flow, drain, stop, NULL, sizeof(priv_t)
+  };
+  static char const * lines[] = {
+    "Uses the Speex DSP library to improve perceived sound quality.",
+    "If no options are specified, the -agc and -denoise features are enabled.",
+    "Options:",
+    "-agc [target_level]    Enable automatic gain control, and optionally specify a",
+    "                       target volume level from 1-100 (default is 100).",
+    "-denoise [max_dB]      Enable noise reduction, and optionally specify the max",
+    "                       attenuation (default is 15).",
+    "-dereverb              Enable reverb reduction.",
+    "-fps frames_per_second Specify the number of frames per second from 1-100",
+    "                       (default is 20).",
+    "-spf samples_per_frame Specify the number of samples per frame. Default is to",
+    "                       use the -fps setting.",
+  };
+  static char * usage;
+  descriptor.usage = lsx_usage_lines(&usage, lines, array_length(lines));
+  return &descriptor;
 }
 
 #endif /* HAVE_SPEEXDSP */