shithub: sox

Download patch

ref: 03cf73d010001d759c56b1395cc854476e45a1da
parent: 1094247c75da59c9ae90fbc3ce922846ed448ae1
author: cbagwell <cbagwell>
date: Sat Oct 11 13:30:25 EDT 2008

rename functions users shouldn't use to lsx_.

--- a/src/biquad.c
+++ b/src/biquad.c
@@ -31,7 +31,7 @@
 static char const all_width_types[] = "hkboqs";
 
 
-int sox_biquad_getopts(sox_effect_t * effp, int n, char **argv,
+int lsx_biquad_getopts(sox_effect_t * effp, int n, char **argv,
     int min_args, int max_args, int fc_pos, int width_pos, int gain_pos,
     char const * allowed_width_types, filter_t filter_type)
 {
@@ -57,7 +57,7 @@
 }
 
 
-int sox_biquad_start(sox_effect_t * effp)
+int lsx_biquad_start(sox_effect_t * effp)
 {
   priv_t * p = (priv_t *)effp->priv;
   /* Simplify: */
@@ -111,7 +111,7 @@
 }
 
 
-int sox_biquad_flow(sox_effect_t * effp, const sox_sample_t *ibuf,
+int lsx_biquad_flow(sox_effect_t * effp, const sox_sample_t *ibuf,
     sox_sample_t *obuf, size_t *isamp, size_t *osamp)
 {
   priv_t * p = (priv_t *)effp->priv;
--- a/src/biquad.h
+++ b/src/biquad.h
@@ -67,11 +67,11 @@
   double      o1, o2;      /* Filter memory */
 } biquad_t;
 
-int sox_biquad_getopts(sox_effect_t * effp, int n, char **argv,
+int lsx_biquad_getopts(sox_effect_t * effp, int n, char **argv,
     int min_args, int max_args, int fc_pos, int width_pos, int gain_pos,
     char const * allowed_width_types, filter_t filter_type);
-int sox_biquad_start(sox_effect_t * effp);
-int sox_biquad_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+int lsx_biquad_start(sox_effect_t * effp);
+int lsx_biquad_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
                         size_t *isamp, size_t *osamp);
 
 #undef sox_fail
--- a/src/biquads.c
+++ b/src/biquads.c
@@ -66,7 +66,7 @@
 
 
 static int hilo1_getopts(sox_effect_t * effp, int n, char **argv) {
-  return sox_biquad_getopts(effp, n, argv, 1, 1, 0, 1, 2, "",
+  return lsx_biquad_getopts(effp, n, argv, 1, 1, 0, 1, 2, "",
       *effp->handler.name == 'l'? filter_LPF_1 : filter_HPF_1);
 }
 
@@ -78,7 +78,7 @@
   if (n != 0 && strcmp(argv[0], "-2") == 0)
     ++argv, --n;
   p->width = sqrt(0.5); /* Default to Butterworth */
-  return sox_biquad_getopts(effp, n, argv, 1, 2, 0, 1, 2, "qohk",
+  return lsx_biquad_getopts(effp, n, argv, 1, 2, 0, 1, 2, "qohk",
       *effp->handler.name == 'l'? filter_LPF : filter_HPF);
 }
 
@@ -87,12 +87,12 @@
   filter_t type = filter_BPF;
   if (n != 0 && strcmp(argv[0], "-c") == 0)
     ++argv, --n, type = filter_BPF_CSG;
-  return sox_biquad_getopts(effp, n, argv, 2, 2, 0, 1, 2, "hkqob", type);
+  return lsx_biquad_getopts(effp, n, argv, 2, 2, 0, 1, 2, "hkqob", type);
 }
 
 
 static int bandrej_getopts(sox_effect_t * effp, int n, char **argv) {
-  return sox_biquad_getopts(effp, n, argv, 2, 2, 0, 1, 2, "hkqob", filter_notch);
+  return lsx_biquad_getopts(effp, n, argv, 2, 2, 0, 1, 2, "hkqob", filter_notch);
 }
 
 
@@ -104,7 +104,7 @@
   else if (n != 0 && strcmp(argv[0], "-2") == 0)
     ++argv, --n, type = filter_AP2;
   m = 1 + (type == filter_APF);
-  return sox_biquad_getopts(effp, n, argv, m, m, 0, 1, 2, "hkqo", type);
+  return lsx_biquad_getopts(effp, n, argv, m, m, 0, 1, 2, "hkqo", type);
 }
 
 
@@ -112,13 +112,13 @@
   priv_t * p = (priv_t *)effp->priv;
   p->width = 0.5;
   p->fc = *effp->handler.name == 'b'? 100 : 3000;
-  return sox_biquad_getopts(effp, n, argv, 1, 3, 1, 2, 0, "shkqo",
+  return lsx_biquad_getopts(effp, n, argv, 1, 3, 1, 2, 0, "shkqo",
       *effp->handler.name == 'b'?  filter_lowShelf: filter_highShelf);
 }
 
 
 static int equalizer_getopts(sox_effect_t * effp, int n, char **argv) {
-  return sox_biquad_getopts(effp, n, argv, 3, 3, 0, 1, 2, "qohk", filter_peakingEQ);
+  return lsx_biquad_getopts(effp, n, argv, 3, 3, 0, 1, 2, "qohk", filter_peakingEQ);
 }
 
 
@@ -126,7 +126,7 @@
   filter_t type = filter_BPF_SPK;
   if (n != 0 && strcmp(argv[0], "-n") == 0)
     ++argv, --n, type = filter_BPF_SPK_N;
-  return sox_biquad_getopts(effp, n, argv, 1, 2, 0, 1, 2, "hkqo", type);
+  return lsx_biquad_getopts(effp, n, argv, 1, 2, 0, 1, 2, "hkqo", type);
 }
 
 
@@ -135,7 +135,7 @@
   p->fc    = 5283;
   p->width = 0.4845;
   p->gain  = -9.477;
-  return sox_biquad_getopts(effp, n, argv, 0, 0, 0, 1, 2, "s", filter_deemph);
+  return lsx_biquad_getopts(effp, n, argv, 0, 0, 0, 1, 2, "s", filter_deemph);
 }
 
 
@@ -364,7 +364,7 @@
       p->b0 *= g; p->b1 *= g; p->b2 *= g;}
       break;
   }
-  return sox_biquad_start(effp);
+  return lsx_biquad_start(effp);
 }
 
 
@@ -372,7 +372,7 @@
 sox_effect_handler_t const * sox_##name##_effect_fn(void) { \
   static sox_effect_handler_t handler = { \
     #name, usage, flags, \
-    group##_getopts, start, sox_biquad_flow, 0, 0, 0, sizeof(biquad_t)\
+    group##_getopts, start, lsx_biquad_flow, 0, 0, 0, sizeof(biquad_t)\
   }; \
   return &handler; \
 }
--- a/src/compand.c
+++ b/src/compand.c
@@ -95,7 +95,7 @@
     }
   }
 
-  if (!sox_compandt_parse(&l->transfer_fn, argv[1], n>2 ? argv[2] : 0))
+  if (!lsx_compandt_parse(&l->transfer_fn, argv[1], n>2 ? argv[2] : 0))
     return SOX_EOF;
 
   /* Set the initial "volume" to be attibuted to the input channels.
@@ -135,7 +135,7 @@
   for (i = 0; i < l->expectedChannels; ++i)
     sox_debug("Channel %i: attack = %g decay = %g", i,
         l->channels[i].attack_times[0], l->channels[i].attack_times[1]);
-  if (!sox_compandt_show(&l->transfer_fn, effp->global_info->plot))
+  if (!lsx_compandt_show(&l->transfer_fn, effp->global_info->plot))
     return SOX_EOF;
 
   /* Convert attack and decay rates using number of samples */
@@ -204,7 +204,7 @@
     for (chan = 0; chan < filechans; ++chan) {
       int ch = l->expectedChannels > 1 ? chan : 0;
       double level_in_lin = l->channels[ch].volume;
-      double level_out_lin = sox_compandt(&l->transfer_fn, level_in_lin);
+      double level_out_lin = lsx_compandt(&l->transfer_fn, level_in_lin);
       double checkbuf;
 
       if (l->delay_buf_size <= 0) {
@@ -245,7 +245,7 @@
     for (chan = 0; chan < effp->out_signal.channels; ++chan) {
       int c = l->expectedChannels > 1 ? chan : 0;
       double level_in_lin = l->channels[c].volume;
-      double level_out_lin = sox_compandt(&l->transfer_fn, level_in_lin);
+      double level_out_lin = lsx_compandt(&l->transfer_fn, level_in_lin);
       obuf[done++] = l->delay_buf[l->delay_buf_index++] * level_out_lin;
       l->delay_buf_index %= l->delay_buf_size;
       l->delay_buf_cnt--;
@@ -266,7 +266,7 @@
 {
   priv_t * l = (priv_t *) effp->priv;
 
-  sox_compandt_kill(&l->transfer_fn);
+  lsx_compandt_kill(&l->transfer_fn);
   free(l->channels);
   return SOX_SUCCESS;
 }
--- a/src/compandt.c
+++ b/src/compandt.c
@@ -22,7 +22,7 @@
 
 #define LOG_TO_LOG10(x) ((x) * 20 / M_LN10)
 
-sox_bool sox_compandt_show(sox_compandt_t * t, sox_plot_t plot)
+sox_bool lsx_compandt_show(sox_compandt_t * t, sox_plot_t plot)
 {
   int i;
 
@@ -41,7 +41,7 @@
     for (i = -199; i <= 0; ++i) {
       double in = i/2.;
       double in_lin = pow(10., in/20);
-      printf("%g ", in + 20 * log10(sox_compandt(t, in_lin)));
+      printf("%g ", in + 20 * log10(lsx_compandt(t, in_lin)));
     }
     printf(
       "];\n"
@@ -66,7 +66,7 @@
     for (i = -199; i <= 0; ++i) {
       double in = i/2.;
       double in_lin = pow(10., in/20);
-      printf("%g %g\n", in, in + 20 * log10(sox_compandt(t, in_lin)));
+      printf("%g %g\n", in, in + 20 * log10(lsx_compandt(t, in_lin)));
     }
     printf(
       "e\n"
@@ -153,7 +153,7 @@
   return sox_true;
 }
 
-sox_bool sox_compandt_parse(sox_compandt_t * t, char * points, char * gain)
+sox_bool lsx_compandt_parse(sox_compandt_t * t, char * points, char * gain)
 {
   char const * text = points;
   unsigned i, j, num, pairs, commas = 0;
@@ -218,7 +218,7 @@
   return sox_true;
 }
 
-void sox_compandt_kill(sox_compandt_t * p)
+void lsx_compandt_kill(sox_compandt_t * p)
 {
   free(p->segments);
 }
--- a/src/compandt.h
+++ b/src/compandt.h
@@ -28,12 +28,12 @@
   double curve_dB;
 } sox_compandt_t;
 
-sox_bool sox_compandt_parse(sox_compandt_t * t, char * points, char * gain);
-sox_bool sox_compandt_show(sox_compandt_t * t, sox_plot_t plot);
-void    sox_compandt_kill(sox_compandt_t * p);
+sox_bool lsx_compandt_parse(sox_compandt_t * t, char * points, char * gain);
+sox_bool lsx_compandt_show(sox_compandt_t * t, sox_plot_t plot);
+void    lsx_compandt_kill(sox_compandt_t * p);
 
 /* Place in header to allow in-lining */
-static double sox_compandt(sox_compandt_t * t, double in_lin)
+static double lsx_compandt(sox_compandt_t * t, double in_lin)
 {
   struct sox_compandt_segment * s;
   double in_log, out_log;
--- a/src/mcompand.c
+++ b/src/mcompand.c
@@ -255,7 +255,7 @@
         ++i;
       } while (s != NULL);
 
-      if (!sox_compandt_parse(&l->transfer_fn, argv[1], n>2 ? argv[2] : 0))
+      if (!lsx_compandt_parse(&l->transfer_fn, argv[1], n>2 ? argv[2] : 0))
         return SOX_EOF;
 
       /* Set the initial "volume" to be attibuted to the input channels.
@@ -434,7 +434,7 @@
     for (chan = 0; chan < filechans; ++chan) {
       int ch = l->expectedChannels > 1 ? chan : 0;
       double level_in_lin = l->volume[ch];
-      double level_out_lin = sox_compandt(&l->transfer_fn, level_in_lin);
+      double level_out_lin = lsx_compandt(&l->transfer_fn, level_in_lin);
       double checkbuf;
 
       if (c->delay_buf_size <= 0) {
@@ -612,7 +612,7 @@
 
   for (band = 0; band < c->nBands; band++) {
     l = &c->bands[band];
-    sox_compandt_kill(&l->transfer_fn);
+    lsx_compandt_kill(&l->transfer_fn);
     free(l->decayRate);
     free(l->attackRate);
     free(l->volume);