shithub: sox

Download patch

ref: 07b47062af734cdf690a7f72e8546188a207295e
parent: 0dd7d2c206eecd6f423d557a16af3e5d07a7b1d3
author: robs <robs>
date: Tue Jan 16 17:48:30 EST 2007

-- no good as null file indicator, changing back.

--- a/sox.1
+++ b/sox.1
@@ -285,7 +285,7 @@
 plays an audio file (through the default sound device) whilst applying a
 bass boosting effect,
 .SP
-	play \-c 4 \-\- \-c 1 synth sin %\-12 sin %\-9 sin %\-5 sin %\-2 vol 0\*d7 avg fade q 0\*d1 1 0\*d1
+	play \-c 4 \-n \-c 1 synth sin %\-12 sin %\-9 sin %\-5 sin %\-2 vol 0\*d7 avg fade q 0\*d1 1 0\*d1
 .SP
 plays a synthesised `A minor seventh' chord with a pipe-organ sound,
 .SP
@@ -318,7 +318,7 @@
 .B \-t
 below) must also be given.
 .TP
-\fB\-\-\fR
+\fB\-n\fR
 This can be used in place of an input or output filename
 to specify that a `null' file is to be used.
 .SP
@@ -336,17 +336,17 @@
 are by default 2 and 44\*d1kHz respectively, but these can be overridden
 if necessary by using appropriate command-line format options.
 .SP
-One other use of \fB\-\-\fR is to use it in conjunction with
+One other use of \fB\-n\fR is to use it in conjunction with
 .B \-V
 to display information from the audio file header
 without having to read any further into the file, e.g.
-.B sox \-V *.wav \-\-
+.B sox \-V *.wav \-n
 will display header information for each `WAV' file in the current
 directory.
 .TP
 \fB\-e\fR
 This is an alias of
-.B \-\-
+.B \-n
 and is retained for backwards compatibility only.
 .PP
 .B N.B.
@@ -402,7 +402,7 @@
 commands to plot the effect's transfer function, and then exit
 without actually processing any audio.  E.g.
 .SP
-	sox \-\-octave input-file \-\- highpass 1320 > plot.m
+	sox \-\-octave input-file \-n highpass 1320 > plot.m
 .br
 	octave plot.m
 .TP
@@ -1823,7 +1823,7 @@
 still be given.  This can be used to set the synthesised audio
 length, the number of channels, and the sampling rate, however since the
 input file's audio is not needed, the null
-file `\fB\-\-\fR' is usually given instead (and the length specified
+file `\fB\-n\fR' is usually given instead (and the length specified
 as a parameter to \fBsynth\fR or by another given effect that can has an
 associated length).
 .SP
@@ -1830,11 +1830,11 @@
 For example, the following produces a 3 second, 44\*d1kHz,
 stereo audio file containing a sine-wave swept from 300 to 3300Hz.
 .SP
-	sox \-\- output.au synth 3 sine 300\-3300
+	sox \-n output.au synth 3 sine 300\-3300
 .SP
 This produces an 8kHz mono version:
 .SP
-	sox \-r 8000 \-c 1 \-\- output.au synth 3 sine 300\-3300
+	sox \-r 8000 \-c 1 \-n output.au synth 3 sine 300\-3300
 .SP
 Multiple channels can be synthesised by specifying the set of
 parameters shown between braces multiple times;
@@ -1841,18 +1841,18 @@
 the following puts the swept tone in the left channel and adds `brown'
 noise in the right:
 .SP
-	sox \-\- output.au synth 3 sine 300\-3300 brownnoise
+	sox \-n output.au synth 3 sine 300\-3300 brownnoise
 .SP
 The following example shows how two synth effects can be cascaded
 to create a more complex waveform:
 .SP
-	sox \-\- output.au synth 0\*d5 sine 200\-500 synth 0\*d5 sine fmod 700\-100
+	sox \-n output.au synth 0\*d5 sine 200\-500 synth 0\*d5 sine fmod 700\-100
 .SP
 Frequencies can also be given as a number of musical semitones relative
 to `middle A' (440Hz) by prefixing a `%' character;  for example, the
 following could be used to help tune a guitar's `E' strings:
 .SP
-	play \-\- synth sine %\-17
+	play \-n synth sine %\-17
 .SP
 .B N.B.
 This effect generates audio at maximum volume, which means that there
--- a/src/sox.c
+++ b/src/sox.c
@@ -271,7 +271,7 @@
       if (fi->filetype != NULL && strcmp(fi->filetype, "null") != 0)
         st_warn("Ignoring '-t %s'.", fi->filetype);
       fi->filetype = "null";
-      fi->filename = xstrdup("--");
+      fi->filename = xstrdup("-n");
     } else {
       if (optind >= argc || is_effect_name(argv[optind]))
         break;
@@ -428,7 +428,7 @@
   return result;
 }
 
-static char *getoptstr = "+abc:defghilmoqr:st:uv:wxABC:DLMNRSUV::X12348";
+static char *getoptstr = "+abc:defghilmnoqr:st:uv:wxABC:DLMNRSUV::X12348";
 
 static struct option long_options[] =
   {
@@ -464,10 +464,6 @@
     int i;          /* Needed since scanf %u allows negative numbers :( */
     char dummy;     /* To check for extraneous chars in optarg. */
 
-    if (optind < argc && strcmp(argv[optind], "--") == 0) {
-      ++optind;
-      return true;  /* I.e. is null file. */
-    }
     switch (getopt_long(argc, argv, getoptstr, long_options, &option_index)) {
     case -1:        /* @ one of: file-name, effect name, end of arg-list. */
       return false; /* I.e. not null file. */
@@ -530,7 +526,7 @@
       repeatable_random = true;
       break;
 
-    case 'e': /* Deprecated in favour of -- */
+    case 'e': case 'n':
       return true;  /* I.e. is null file. */
       break;
 
@@ -1607,7 +1603,7 @@
   printf(
          "SPECIAL FILENAMES:\n"
          "-               stdin (infile) or stdout (outfile)\n"
-         "--              use the null file handler; for use with e.g. synth & stat\n"
+         "-n              use the null file handler; for use with e.g. synth & stat\n"
          "\n"
          "GLOBAL OPTIONS (gopts) (can be specified at any point before the first effect):\n"
          "-h, --help      display version number and usage information\n"
--- a/src/tests.sh
+++ b/src/tests.sh
@@ -34,7 +34,7 @@
       if [ "${format1_skip}x" = "x" -a "${from_skip}x" = "x" ] ; then
         getFormat ${format1}; format1Text=$formatText; format1Flags=$formatFlags
         getFormat       $1; format2Text=$formatText; format2Flags=$formatFlags
-        ./sox -c $channels -r $rate -- $format1Flags input.$format1 synth $samples's' sin 300-3300 noise trapezium
+        ./sox -c $channels -r $rate -n $format1Flags input.$format1 synth $samples's' sin 300-3300 noise trapezium
         ./sox $verbose -r $rate -c $channels $format1Flags input.$format1 $format2Flags intermediate.$1
         ./sox $verbose -r $rate -c $channels $format2Flags intermediate.$1 $format1Flags output.$format1
 
@@ -119,7 +119,7 @@
 fi
 do_singlechannel_formats
 
-./sox -c 1 -- output.ub synth .01 vol .5
+./sox -c 1 -n output.ub synth .01 vol .5
 if [ `wc -c <output.ub` = 441 ]; then
   echo "ok     synth size"
 else