shithub: sox

Download patch

ref: a68ea702c1164b71cbf509c7b76db2c3310b73c8
parent: f5af200cef7352195994ee670c35a0f348d73732
author: Ulrich Klauer <ulrich@chirlu.de>
date: Mon Dec 26 03:36:55 EST 2011

Remove deprecated rate aliases (resample, polyphase, rabbit)

--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,9 @@
   ated in  [F(ormat)] [E(ffect)]   Replacement
   -------  ----------------------  ----------------------
   14.3.0   O --interactive         --no-clobber
+  14.1.0   E resample alias        rate
+  14.1.0   E polyphase alias       rate
+  14.1.0   E rabbit alias          rate
 
 Previously deprecated features (to be removed in future):
 
@@ -30,9 +33,6 @@
   14.3.0   O -A/-U/-o/-i/-a/-g     -e                      14.4.0
   14.2.0   E key alias             pitch                   (now)
   14.2.0   E pan                   ~= mixer/remix          (now)
-  14.1.0   E resample alias        rate                    (now)
-  14.1.0   E polyphase alias       rate                    (now)
-  14.1.0   E rabbit alias          rate                    (now)
 
 File formats:
 
--- a/sox.1
+++ b/sox.1
@@ -4230,19 +4230,6 @@
 .I direction
 is a value from \-1 to 1.  \-1 represents
 far left and 1 represents far right.
-.PP
-\fBpolyphase\fR [\fB\-w nut\fR\^|\^\fBham\fR] [\fB\-width \fIn\fR] [\fB\-cut-off \fIc\fR]
-.br
-\fBrabbit\fR [\fB\-c0\fR\^|\^\fB\-c1\fR\^|\^\fB\-c2\fR\^|\^\fB\-c3\fR\^|\^\fB\-c4\fR]
-.br
-\fBresample\fR [\fB\-qs\fR\^|\^\fB\-q\fR\^|\^\fB\-ql\fR] [\fIrolloff\fR [\fIbeta\fR]]
-.if t .sp -.5
-.if n .sp -1
-.TP
-\ 
-Formerly sample-rate-changing effects in their own right, these are now just aliases for the
-.B rate
-effect.
 .SH DIAGNOSTICS
 Exit status is 0 for no error, 1 if there is a problem with the
 command-line parameters, or 2 if an error occurs during file processing.
--- a/src/effects.h
+++ b/src/effects.h
@@ -65,12 +65,9 @@
   EFFECT(pan)
   EFFECT(phaser)
   EFFECT(pitch)
-  EFFECT(polyphase)
-  EFFECT(rabbit)
   EFFECT(rate)
   EFFECT(remix)
   EFFECT(repeat)
-  EFFECT(resample)
   EFFECT(reverb)
   EFFECT(reverse)
   EFFECT(riaa)
--- a/src/rate.c
+++ b/src/rate.c
@@ -558,125 +558,3 @@
   handler.usage = lsx_usage_lines(&usage, lines, array_length(lines));
   return &handler;
 }
-
-/*------------------- emulation of the old `rabbit' effect -------------------*/
-
-static int rabbit_getopts(sox_effect_t * effp, int argc, char * * argv)
-{
-  static char const * const qualities[] = {"-v", "-h", "-l", "-q", "-q"};
-  char quality[2] = "0", dummy;     /* To check for extraneous chars. */
-  char * args[] = {0, 0, 0};
-  int argc2 = 2;
-
-  if (argc > 1) {
-    int n = sscanf(argv[1], "-c%1[0-4] %c", quality, &dummy);
-    if (n > 1)
-      return lsx_usage(effp);
-    if (n == 1)
-      --argc, ++argv;
-  }
-
-  args[0] = argv[0];
-  args[1] = (char *)qualities[quality[0] - '0'];
-  if (argc > 1) {
-    args[2] = argv[1];
-    --argc, ++argv;
-    ++argc2;
-  }
-  return argc > 1? lsx_usage(effp) : 
-    lsx_rate_effect_fn()->getopts(effp, argc2, args);
-}
-
-sox_effect_handler_t const * lsx_rabbit_effect_fn(void)
-{
-  static sox_effect_handler_t handler;
-  handler = *lsx_rate_effect_fn();
-  handler.name = "rabbit";
-  handler.usage = "[-c0|-c1|-c2|-c3|-c4] [rate]";
-  handler.getopts = rabbit_getopts;
-  handler.flags |= SOX_EFF_DEPRECATED;
-  return &handler;
-}
-
-/*------------------ emulation of the old `polyphase' effect -----------------*/
-
-static int polyphase_getopts(sox_effect_t * effp, int argc, char * * argv)
-{
-  char arg[100], * args[] = {0, "-vb", 0};
-  double bandwidth = 95;
-
-  for (--argc, ++argv; argc >= 2; argc -= 2, argv += 2)
-    if (!strcmp(argv[0], "-cutoff"))
-      bandwidth = 100 * atof(argv[1]);
-    else if (strcmp(argv[0], "-w") && strcmp(argv[0], "-width")) {
-      lsx_fail("unknown parameter: %s %s", argv[0], argv[1]);
-      return SOX_EOF;
-    }
-  args[0] = argv[0];
-  args[2] = arg;
-  sprintf(arg, "%f", bandwidth);
-  return argc? lsx_usage(effp) : 
-    lsx_rate_effect_fn()->getopts(effp, (int)array_length(args), args);
-}
-
-sox_effect_handler_t const * lsx_polyphase_effect_fn(void)
-{
-  static sox_effect_handler_t handler;
-  handler = *lsx_rate_effect_fn();
-  handler.name = "polyphase";
-  handler.usage = "-cutoff factor    Cutoff frequency 0 to 1, default 0.95";
-  handler.getopts = polyphase_getopts;
-  handler.flags |= SOX_EFF_DEPRECATED;
-  return &handler;
-}
-
-/*------------------ emulation of the old `resample' effect ------------------*/
-
-static int resample_getopts(sox_effect_t * effp, int argc, char * * argv)
-{
-  char arg[100], * args[] = {0, 0, "-b", 0};
-  double bandwidth = .8;
-  char const * quality = NULL;
-
-  --argc, ++argv;
-  if (argc) {
-    if (!strcmp(argv[0], "-qs")) {
-      quality = "-h";
-      --argc, ++argv;
-    }
-    else if (!strcmp(argv[0], "-q")) {
-      bandwidth = .875;
-      quality = "-v";
-      --argc, ++argv;
-    }
-    else if (!strcmp(argv[0], "-ql")) {
-      bandwidth = .94;
-      quality = "-v";
-      --argc, ++argv;
-    }
-  }
-  if (argc) {
-    if (sscanf(argv[0], "%lf", &bandwidth) != 1)
-      return lsx_usage(effp);
-    if (!quality)
-      quality = "-m";
-  }
-
-  args[0] = argv[0];
-  args[1] = (char *)(quality? quality : "-l");
-  args[3] = arg;
-  sprintf(arg, "%f", 100 * bandwidth);
-  return argc > 2 ? lsx_usage(effp) : 
-    lsx_rate_effect_fn()->getopts(effp, quality? 4 : 2, args);
-}
-
-sox_effect_handler_t const * lsx_resample_effect_fn(void)
-{
-  static sox_effect_handler_t handler;
-  handler = *lsx_rate_effect_fn();
-  handler.name = "resample";
-  handler.usage = "[ -qs | -q | -ql ] [ rolloff [ beta ] ]",
-  handler.getopts = resample_getopts;
-  handler.flags |= SOX_EFF_DEPRECATED;
-  return &handler;
-}
--- a/test/ltest.pl
+++ b/test/ltest.pl
@@ -23,11 +23,11 @@
 
 # set default values
 my $sox='../src/sox';
-my $effect='resample';
-#my $effect='resample -qs';
-#my $effect='resample -q';
-#my $effect='resample -ql';
-#my $effect='polyphase -cutoff 0.90';
+my $effect='rate';
+#my $effect='rate -q';
+#my $effect='rate -l';
+#my $effect='rate -h -M';
+#my $effect='rate -h -b 90';
 #my $effect='filter 400-2000';
 #my $effect='filter 400-2000 1024';
 
@@ -60,7 +60,7 @@
 }
 
 my $ratechange=0;
-if ($effect =~ m{^(rabbit|resample|polyphase|rate)}) {
+if ($effect =~ m{^(rate|upsample|downsample|speed)}) {
   $ratechange=1;
 }