ref: b0022bd56982e62203b7332f0fe579f636682630
parent: dfaee703c5704ad796f152e45df0bd4c5d4106b7
author: rrt <rrt>
date: Wed Apr 11 16:18:12 EDT 2007
Fix --enable-debug, which I recently broke. Add --buffer, closing #1622660. Make documentation of options consistent between sox.c and sox(1), and use upper case for variable arguments. Remove deprecated size options -b, -w, -l and -d. Make verbosity level unsigned.
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,6 @@
dnl Debugging
AC_MSG_CHECKING([whether to make a debug build])
-enable_debug=no
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [make a debug build]))
AC_MSG_RESULT($enable_debug)
if test "$enable_debug" = "yes"; then
@@ -27,6 +26,8 @@
if test "$GCC" = "yes"; then
CFLAGS="$CFLAGS -ggdb"
fi
+else
+ enable_debug=no
fi
dnl Extra CFLAGS if we have gcc
--- a/sox.1
+++ b/sox.1
@@ -77,13 +77,13 @@
.EE
translates an audio file in Sun AU format to a Microsoft WAV file, whilst:
.EX
- sox recital.au -r 12000 -b -c 1 recital.wav vol 0.7 dither
+ sox recital.au -r 12000 -1 -c 1 recital.wav vol 0.7 dither
.EE
performs the same format translation, but also changes the audio
sampling rate & sample size, down-mixes to mono, and applies
the \fBvol\fR and \fBdither\fR effects.
.EX
- sox -r 8000 -u -b -c 1 voice-memo.raw voice-memo.wav
+ sox -r 8000 -u -1 -c 1 voice-memo.raw voice-memo.wav
.EE
adds a header to a raw audio file,
.EX
@@ -445,7 +445,7 @@
\fB\-h\fR, \fB\-\-help\fR
Show version number and usage information.
.TP
-\fB\-\-help\-effect=\fIname\fR
+\fB\-\-help\-effect=\fINAME\fR
Show usage information on the specified effect. The name
\fBall\fR can be used to show usage on all effects.
.TP
@@ -467,7 +467,10 @@
option is strongly recommended; a `shell' alias, script, or batch file
may be an appropriate way of permanently enabling it.
.TP
-\fB\-m\fR\^|\^\fB\-M\fR\^|\^\fB\-\-combine=concatenate\fR\^|\^\fBmerge\fR\^|\^\fBmix\fR\^|\^\fBsequence\fR
+\fB\-\-buffer\fR \fBBYTES\fR
+Set the size in bytes of the buffers used for reading and writing sound data (default 8192).
+.TP
+\fB\-m\fR\^|\^\fB\-M\fR\^|\^\fB\-\-combine concatenate\fR\^|\^\fBmerge\fR\^|\^\fBmix\fR\^|\^\fBsequence\fR
Select the input file combining method;
.B \-m
selects `mix',
@@ -493,11 +496,11 @@
Run in quiet mode when SoX wouldn't otherwise do so;
this is the opposite of the \fB\-S\fR option.
.PP
-\fB\-\-replay\-gain=track\fR
+\fB\-\-replay\-gain track\fR
.br
-\fB\-\-replay\-gain=album\fR
+\fB\-\-replay\-gain album\fR
.br
-\fB\-\-replay\-gain=off\fR
+\fB\-\-replay\-gain off\fR
.if t .sp -.5
.if n .sp -1
.TP
@@ -560,8 +563,8 @@
These options apply only to input files and may precede only input
filenames on the command line.
.TP
-\fB\-v \fIvolume\fR, \fB\-\-volume=\fIvolume\fR
-Adjust volume by a factor of \fIvolume\fR.
+\fB\-v\fR, \fB\-\-volume\fR \fIFACTOR\fR
+Adjust volume by a factor of \fIFACTOR\fR.
This is a linear (amplitude) adjustment, so a number less than 1
decreases the volume; greater than 1 increases it. If a negative number
is given, then in addition to the volume adjustment, the audio signal
@@ -578,7 +581,7 @@
working with headerless file formats or when specifying a format
for the output file that is different to that of the input file.
.TP
-\fB\-c \fIchannels\fR, \fB\-\-channels=\fIchannels\fR
+\fB\-c\fR, \fB\-\-channels\fR \fICHANNELS\fR
The number of audio channels in the audio file.
This may be 1, 2, or 4; for mono, stereo, or quad audio. To cause
the output file to have a different number of channels than the input
@@ -590,7 +593,7 @@
effect is not specified on the
command line it will be invoked internally with default parameters.
.TP
-\fB\-\-comment \fItext\fR
+\fB\-\-comment \fITEXT\fR
Specify the comment text to store in the output file header (where
applicable).
.SP
@@ -598,15 +601,13 @@
.BR \-\-comment\-file )
is not given; to specify that no comment should be stored in the output file,
use
-.B "\-\-comment \(dq\(dq"
-or
-.BR \-\-comment= .
+.B "\-\-comment \(dq\(dq" .
.TP
-\fB\-\-comment\-file \fIfilename\fR
+\fB\-\-comment\-file \fIFILENAME\fR
Specify a file containing the comment text to store in the output
file header (where applicable).
.TP
-\fB\-r \fIrate\fR, \fB\-\-rate=\fIrate\fR
+\fB\-r, \fB\-\-rate\fR \fIRATE\fR
Gives the sample rate in Hz of the file. To cause the output file to have
a different sample rate than the input file, include this option with
the output file format options.
@@ -617,7 +618,7 @@
multiple rate changing effects, the user can specify which to use as an effect.
If no rate change effect is specified then a default one will be chosen.
.TP
-\fB\-t \fIfile-type\fR, \fB\-\-type=\fIfile-type\fR
+\fB\-t\fR, \fB\-\-type\fR \fIfile-type\fR
Gives the type of the audio file. This is useful when the
file extension is non-standard or when the type can not be determined by
looking at the header of the file.
@@ -629,11 +630,11 @@
.SP
See \fBFILE TYPES\fR below for a list of supported file types.
.PP
-\fB\-L\fR, \fB\-\-endian=little\fR
+\fB\-L\fR, \fB\-\-endian little\fR
.br
-\fB\-B\fR, \fB\-\-endian=big\fR
+\fB\-B\fR, \fB\-\-endian big\fR
.br
-\fB\-x\fR, \fB\-\-endian=swap\fR
+\fB\-x\fR, \fB\-\-endian swap\fR
.if t .sp -.5
.if n .sp -1
.TP
@@ -731,7 +732,7 @@
These options apply only to the output file and may precede only the output
filename on the command line.
.TP
-\fB\-C \fIcompression-factor\fR, \fB\-\-compression=\fIcompression-factor\fR
+\fB\-C\fR, \fB\-\-compression\fR \fIFACTOR\fR
The compression factor for variably compressing output file formats. If
this option is not given, then a default compression factor will apply.
The compression factor is interpreted differently for different
@@ -1034,7 +1035,7 @@
the input file. It is suggested to always override the output values
to use the highest quality format your OSS system can handle. Example:
.EX
- sox infile -t ossdsp -w -s /dev/dsp
+ sox infile -t ossdsp -2 -s /dev/dsp
.EE
.TP
\&\fB.paf\fR, \fB.fap\fR \fB(libsndfile)\fR
@@ -1114,7 +1115,7 @@
input file. It is suggested to always override the output values to use
the highest quality format your hardware can handle. Example:
.EX
- sox infile -t sunau -w -s /dev/audio
+ sox infile -t sunau -2 -s /dev/audio
.EE
or
.EX
--- a/src/adpcms.c
+++ b/src/adpcms.c
@@ -122,8 +122,8 @@
static int adpcm_start(ft_t ft, adpcm_io_t state, sox_encoding_t type)
{
/* setup file info */
- state->file.buf = (char *) xmalloc(SOX_BUFSIZ);
- state->file.size = SOX_BUFSIZ;
+ state->file.buf = (char *) xmalloc(sox_bufsiz);
+ state->file.size = sox_bufsiz;
ft->signal.channels = 1;
sox_adpcm_reset(state, type);
--- a/src/alsa.c
+++ b/src/alsa.c
@@ -290,7 +290,7 @@
}
/* Have a much larger buffer than SOX_BUFSIZ to avoid underruns */
- buffer_size = SOX_BUFSIZ * 8 / ft->signal.size / ft->signal.channels;
+ buffer_size = sox_bufsiz * 8 / ft->signal.size / ft->signal.channels;
if (snd_pcm_hw_params_get_buffer_size_min(hw_params, &buffer_size_min) < 0)
{
--- a/src/flac.c
+++ b/src/flac.c
@@ -314,7 +314,7 @@
sox_fail_errno(format, SOX_ENOMEM, "FLAC ERROR creating the encoder instance");
return SOX_EOF;
}
- encoder->decoded_samples = xmalloc(SOX_BUFSIZ * sizeof(FLAC__int32));
+ encoder->decoded_samples = xmalloc(sox_bufsiz * sizeof(FLAC__int32));
{ /* Select and set FLAC encoder options: */
static struct {
--- a/src/mp3.c
+++ b/src/mp3.c
@@ -25,7 +25,7 @@
#include <math.h>
#endif
-#define INPUT_BUFFER_SIZE (SOX_BUFSIZ)
+#define INPUT_BUFFER_SIZE (sox_bufsiz)
/* Private data */
struct mp3priv {
--- a/src/sox.c
+++ b/src/sox.c
@@ -56,6 +56,8 @@
#include <io.h>
#endif
+sox_size_t sox_bufsiz = 8192;
+
static sox_bool play = sox_false, rec = sox_false;
static enum {SOX_sequence, SOX_concatenate, SOX_mix, SOX_merge} combine_method = SOX_concatenate;
static sox_size_t mixing_clips = 0;
@@ -75,10 +77,7 @@
static unsigned long read_wide_samples = 0;
static unsigned long output_samples = 0;
-static sox_sample_t ibufl[SOX_BUFSIZ / 2]; /* Left/right interleave buffers */
-static sox_sample_t ibufr[SOX_BUFSIZ / 2];
-static sox_sample_t obufl[SOX_BUFSIZ / 2];
-static sox_sample_t obufr[SOX_BUFSIZ / 2];
+static sox_sample_t *ibufl, *ibufr, *obufl, *obufr; /* Left/right interleave buffers */
typedef struct file_info
{
@@ -152,7 +151,7 @@
static char *myname = NULL;
-static void output_message(int level, const char *filename, const char *fmt, va_list ap)
+static void output_message(unsigned level, const char *filename, const char *fmt, va_list ap)
{
if (sox_output_verbosity_level >= level) {
fprintf(stderr, "%s ", myname);
@@ -166,13 +165,13 @@
char c;
if (!interactive) {
- sox_report("Overwriting '%s'", filename);
+ sox_report("Overwriting `%s'", filename);
return sox_true;
}
- sox_warn("Output file '%s' already exists", filename);
+ sox_warn("Output file `%s' already exists", filename);
if (!isatty(fileno(stdin)))
return sox_false;
- do fprintf(stderr, "%s sox: overwrite '%s' (y/n)? ", myname, filename);
+ do fprintf(stderr, "%s sox: overwrite `%s' (y/n)? ", myname, filename);
while (scanf(" %c%*[^\n]", &c) != 1 || !strchr("yYnN", c));
return c == 'y' || c == 'Y';
}
@@ -388,7 +387,7 @@
if (doopts(f, argc, argv)) { /* is null file? */
if (f->filetype != NULL && strcmp(f->filetype, "null") != 0)
- sox_warn("Ignoring '-t %s'.", f->filetype);
+ sox_warn("Ignoring `-t %s'.", f->filetype);
f->filetype = "null";
f->filename = xstrdup("-n");
} else {
@@ -460,6 +459,12 @@
}
parse_options_and_filenames(argc, argv);
+ /* Allocate buffers, size of which may have been set by --buffer */
+ ibufl = xcalloc(sox_bufsiz / 2, sizeof(sox_sample_t));
+ obufl = xcalloc(sox_bufsiz / 2, sizeof(sox_sample_t));
+ ibufr = xcalloc(sox_bufsiz / 2, sizeof(sox_sample_t));
+ obufr = xcalloc(sox_bufsiz / 2, sizeof(sox_sample_t));
+
/* Make sure we got at least the required # of input filenames */
input_count = file_count ? file_count - 1 : 0;
if (input_count < (combine_method <= SOX_concatenate ? 1 : 2))
@@ -474,7 +479,7 @@
}
if (ofile->volume != HUGE_VAL)
usage("-v can only be given for an input file;\n"
- "\tuse 'vol' to set the output file volume");
+ "\tuse `vol' to set the output file volume");
signal(SIGINT, SIG_IGN); /* So child pipes aren't killed by track skip */
for (i = 0; i < input_count; i++) {
@@ -601,10 +606,11 @@
return result;
}
-static char *getoptstr = "+abc:defghilmnoqr:st:uv:wxABC:DLMNRSUV::X12348";
+static char *getoptstr = "+ac:efghimnoqr:st:uv:xABC:DLMNRSUV::X12348";
static struct option long_options[] =
{
+ {"buffer" , required_argument, NULL, 0},
{"combine" , required_argument, NULL, 0},
{"comment-file" , required_argument, NULL, 0},
{"comment" , required_argument, NULL, 0},
@@ -703,28 +709,37 @@
{
while (sox_true) {
int option_index;
- int i; /* Needed since scanf %u allows negative numbers :( */
+ int i; /* sscanf silently accepts negative numbers for %u :( */
char dummy; /* To check for extraneous chars in optarg. */
switch (getopt_long(argc, argv, getoptstr, long_options, &option_index)) {
case -1: /* @ one of: file-name, effect name, end of arg-list. */
- return sox_false; /* I.e. not null file. */
+ return sox_false; /* i.e. not null file. */
case 0: /* Long options with no short equivalent. */
switch (option_index) {
case 0:
- combine_method = enum_option(option_index, combine_methods);
+#define SOX_BUFMIN 16
+ if (sscanf(optarg, "%i %c", &i, &dummy) != 1 || i <= SOX_BUFMIN) {
+ sox_fail("Buffer size `%s' must be > %d", optarg, SOX_BUFMIN);
+ exit(1);
+ }
+ sox_bufsiz = i;
break;
case 1:
- f->comment = read_comment_file(optarg);
+ combine_method = enum_option(option_index, combine_methods);
break;
case 2:
- f->comment = xstrdup(optarg);
+ f->comment = read_comment_file(optarg);
break;
case 3:
+ f->comment = xstrdup(optarg);
+ break;
+
+ case 4:
switch (enum_option(option_index, endian_options)) {
case ENDIAN_little: f->signal.reverse_bytes = SOX_IS_BIGENDIAN; break;
case ENDIAN_big: f->signal.reverse_bytes = SOX_IS_LITTLEENDIAN; break;
@@ -732,23 +747,23 @@
}
break;
- case 4:
+ case 5:
interactive = sox_true;
break;
- case 5:
+ case 6:
usage_effect(optarg);
break;
- case 6:
+ case 7:
globalinfo.octave_plot_effect = sox_true;
break;
- case 7:
+ case 8:
replay_gain_mode = enum_option(option_index, rg_modes);
break;
- case 8:
+ case 9:
printf("%s: v%s\n", myname, PACKAGE_VERSION);
exit(0);
break;
@@ -783,7 +798,7 @@
case 'r':
if (sscanf(optarg, "%i %c", &i, &dummy) != 1 || i <= 0) {
- sox_fail("Rate value '%s' is not a positive integer", optarg);
+ sox_fail("Rate value `%s' is not a positive integer", optarg);
exit(1);
}
f->signal.rate = i;
@@ -791,7 +806,7 @@
case 'v':
if (sscanf(optarg, "%lf %c", &f->volume, &dummy) != 1) {
- sox_fail("Volume value '%s' is not a number", optarg);
+ sox_fail("Volume value `%s' is not a number", optarg);
exit(1);
}
uservolume = sox_true;
@@ -802,7 +817,7 @@
case 'c':
if (sscanf(optarg, "%i %c", &i, &dummy) != 1 || i <= 0) {
- sox_fail("Channels value '%s' is not a positive integer", optarg);
+ sox_fail("Channels value `%s' is not a positive integer", optarg);
exit(1);
}
f->signal.channels = i;
@@ -810,16 +825,16 @@
case 'C':
if (sscanf(optarg, "%lf %c", &f->signal.compression, &dummy) != 1) {
- sox_fail("Compression value '%s' is not a number", optarg);
+ sox_fail("Compression value `%s' is not a number", optarg);
exit(1);
}
break;
- case '1': case 'b': f->signal.size = SOX_SIZE_BYTE; break;
- case '2': case 'w': f->signal.size = SOX_SIZE_16BIT; break;
- case '3': f->signal.size = SOX_SIZE_24BIT; break;
- case '4': case 'l': f->signal.size = SOX_SIZE_32BIT; break;
- case '8': case 'd': f->signal.size = SOX_SIZE_64BIT; break;
+ case '1': f->signal.size = SOX_SIZE_BYTE; break;
+ case '2': f->signal.size = SOX_SIZE_16BIT; break;
+ case '3': f->signal.size = SOX_SIZE_24BIT; break;
+ case '4': f->signal.size = SOX_SIZE_32BIT; break;
+ case '8': f->signal.size = SOX_SIZE_64BIT; break;
case 's': f->signal.encoding = SOX_ENCODING_SIGN2; break;
case 'u': f->signal.encoding = SOX_ENCODING_UNSIGNED; break;
@@ -852,12 +867,12 @@
case 'V':
if (optarg == NULL)
++sox_output_verbosity_level;
- else if (sscanf(optarg, "%i %c", &sox_output_verbosity_level, &dummy) != 1
- || sox_output_verbosity_level < 0) {
+ else if (sscanf(optarg, "%i %c", &i, &dummy) != 1 || i < 0) {
sox_output_verbosity_level = 2;
- sox_fail("Verbosity value '%s' is not an integer >= 0", optarg);
+ sox_fail("Verbosity value `%s' is not a non-negative integer", optarg);
exit(1);
}
+ sox_output_verbosity_level = (unsigned)i;
break;
}
}
@@ -975,7 +990,7 @@
static sox_size_t sox_read_wide(ft_t desc, sox_sample_t * buf)
{
- sox_size_t len = SOX_BUFSIZ / combiner.channels;
+ sox_size_t len = sox_bufsiz / combiner.channels;
len = sox_read(desc, buf, len * desc->signal.channels) / desc->signal.channels;
if (!len && desc->sox_errno)
sox_fail("%s: %s (%s)", desc->filename, desc->sox_errstr, strerror(desc->sox_errno));
@@ -1105,9 +1120,9 @@
/* Allocate output buffers for effects */
for (e = 0; e < neffects; e++) {
- efftab[e].obuf = (sox_sample_t *)xmalloc(SOX_BUFSIZ * sizeof(sox_sample_t));
+ efftab[e].obuf = (sox_sample_t *)xmalloc(sox_bufsiz * sizeof(sox_sample_t));
if (efftabR[e].name)
- efftabR[e].obuf = (sox_sample_t *)xmalloc(SOX_BUFSIZ * sizeof(sox_sample_t));
+ efftabR[e].obuf = (sox_sample_t *)xmalloc(sox_bufsiz * sizeof(sox_sample_t));
}
if (combine_method <= SOX_concatenate)
@@ -1115,7 +1130,7 @@
else {
ws = 0;
for (i = 0; i < input_count; i++) {
- ibuf[i] = (sox_sample_t *)xmalloc(SOX_BUFSIZ * sizeof(sox_sample_t));
+ ibuf[i] = (sox_sample_t *)xmalloc(sox_bufsiz * sizeof(sox_sample_t));
progress_to_file(files[i]);
ws = max(ws, input_wide_samples);
}
@@ -1557,7 +1572,7 @@
* run effect over entire buffer.
*/
idone = efftab[e - 1].olen - efftab[e - 1].odone;
- odone = SOX_BUFSIZ - efftab[e].olen;
+ odone = sox_bufsiz - efftab[e].olen;
sox_debug_more("pre %s idone=%d, odone=%d", efftab[e].name, idone, odone);
sox_debug_more("pre %s odone1=%d, olen1=%d odone=%d olen=%d", efftab[e].name, efftab[e-1].odone, efftab[e-1].olen, efftab[e].odone, efftab[e].olen);
@@ -1579,7 +1594,7 @@
* on each of them.
*/
idone = efftab[e - 1].olen - efftab[e - 1].odone;
- odone = SOX_BUFSIZ - efftab[e].olen;
+ odone = sox_bufsiz - efftab[e].olen;
ibuf = &efftab[e - 1].obuf[efftab[e - 1].odone];
for (i = 0; i < idone; i += 2) {
@@ -1670,13 +1685,13 @@
efftab[e].h->drain? efftab[e].h->drain : sox_effect_nothing_drain;
if (! efftabR[e].name) {
- efftab[e].olen = SOX_BUFSIZ;
+ efftab[e].olen = sox_bufsiz;
rc = drain(&efftab[e],efftab[e].obuf, &efftab[e].olen);
efftab[e].odone = 0;
} else {
int rc_l, rc_r;
- olen = SOX_BUFSIZ;
+ olen = sox_bufsiz;
/* left */
olenl = olen/2;
@@ -1826,10 +1841,11 @@
"-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"
+ "--buffer BYTES set the buffer size (default 8192)\n"
"--combine concatenate concatenate multiple input files (default for sox, rec)\n"
"--combine sequence sequence multiple input files (default for play)\n"
"-h, --help display version number and usage information\n"
- "--help-effect name display usage of specified effect; use 'all' to display all\n"
+ "--help-effect NAME display usage of specified effect; use `all' to display all\n"
"--interactive prompt to overwrite output file\n"
"-m, --combine mix mix multiple input files (instead of concatenating)\n"
"-M, --combine merge merge multiple input files (instead of concatenating)\n"
@@ -1839,7 +1855,7 @@
"-R use default random numbers (same on each run of SoX)\n"
"-S, --show-progress display progress while processing audio data\n"
"--version display version number of SoX and exit\n"
- "-V[level] increment or set verbosity level (default 2); levels are:\n"
+ "-V[LEVEL] increment or set verbosity level (default 2); levels are:\n"
" 1: failure messages\n"
" 2: warnings\n"
" 3: details of processing\n"
@@ -1850,13 +1866,13 @@
"otherwise they are obtained automatically. Output files will default to the\n"
"same format options as the input file unless otherwise specified.\n"
"\n"
- "-c, --channels channels number of channels in audio data\n"
- "-C compression compression factor for variably compressing output formats\n"
- "--comment text Specify comment text for the output file\n"
- "--comment-file filename file containing comment text for the output file\n"
+ "-c, --channels CHANNELS number of channels in audio data\n"
+ "-C, --compression FACTOR compression factor for output format\n"
+ "--comment TEXT Specify comment text for the output file\n"
+ "--comment-file FILENAME file containing comment text for the output file\n"
"--endian little|big|swap set endianness; swap means opposite to default\n"
- "-r, --rate rate sample rate of audio\n"
- "-t, --type filetype file type of audio\n"
+ "-r, --rate RATE sample rate of audio\n"
+ "-t, --type FILETYPE file type of audio\n"
"-x invert auto-detected endianness\n"
"-N, --reverse-nibbles nibble-order\n"
"-X, --reverse-bits bit-order of data\n"
@@ -1864,7 +1880,7 @@
"-s/-u/-U/-A/ sample encoding: signed/unsigned/u-law/A-law\n"
" -a/-i/-g/-f ADPCM/IMA_ADPCM/GSM/floating point\n"
"-1/-2/-3/-4/-8 sample size in bytes\n"
- "-v, --volume volume input file volume adjustment factor (real number)\n"
+ "-v, --volume FACTOR volume input file volume adjustment factor (real number)\n"
"\n");
printf("SUPPORTED FILE FORMATS:");
--- a/src/sox_i.h
+++ b/src/sox_i.h
@@ -162,9 +162,9 @@
double sox_swapdf(double d);
/* util.c */
-typedef void (*sox_output_message_handler_t)(int level, const char *filename, const char *fmt, va_list ap);
+typedef void (*sox_output_message_handler_t)(unsigned level, const char *filename, const char *fmt, va_list ap);
extern sox_output_message_handler_t sox_output_message_handler;
-extern int sox_output_verbosity_level;
+extern unsigned sox_output_verbosity_level;
void sox_output_message(FILE *file, const char *filename, const char *fmt, va_list ap);
void sox_fail(const char *, ...);
@@ -202,7 +202,7 @@
* to perform file I/O. It can be useful to pass in similar sized
* data to get max performance.
*/
-#define SOX_BUFSIZ 8192
+extern sox_size_t sox_bufsiz;
extern const char sox_readerr[];
extern const char sox_writerr[];
--- a/src/soxio.c
+++ b/src/soxio.c
@@ -252,7 +252,7 @@
/* stdout tends to be line-buffered. Override this */
/* to be Full Buffering. */
- if (setvbuf (ft->fp, NULL, _IOFBF, sizeof(char)*SOX_BUFSIZ))
+ if (setvbuf (ft->fp, NULL, _IOFBF, sizeof(char)*sox_bufsiz))
{
sox_fail("Can't set write buffer");
goto output_error;
--- a/src/tests.bat
+++ b/src/tests.bat
@@ -16,9 +16,9 @@
echo on
.\sox %noise% %file%.wav ub.raw
-.\sox %noise% -t raw -r 8196 -u -b -c 1 ub.raw -r 8196 -s -b sb.raw
-.\sox %noise% -t raw -r 8196 -s -b -c 1 sb.raw -r 8196 -u -b ub2.raw
-.\sox %noise% -r 8196 -u -b -c 1 ub2.raw -r 8196 ub2.wav
+.\sox %noise% -t raw -r 8196 -u -1 -c 1 ub.raw -r 8196 -s -1 sb.raw
+.\sox %noise% -t raw -r 8196 -s -1 -c 1 sb.raw -r 8196 -u -1 ub2.raw
+.\sox %noise% -r 8196 -u -1 -c 1 ub2.raw -r 8196 ub2.wav
@echo off
echo.
@@ -47,10 +47,10 @@
del ub2.wav
echo on
-.\sox %noise% %file%.au -u -r 8192 -u -b ub.raw
-.\sox %noise% -r 8192 -u -b ub.raw -U -b ub.au
+.\sox %noise% %file%.au -u -r 8192 -u -1 ub.raw
+.\sox %noise% -r 8192 -u -1 ub.raw -U -1 ub.au
.\sox %noise% ub.au -u ub2.raw
-.\sox %noise% ub.au -w ub2.sf
+.\sox %noise% ub.au -2 ub2.sf
@echo off
del ub.raw
--- a/src/tests.sh
+++ b/src/tests.sh
@@ -18,10 +18,10 @@
ul ) formatText="ulaw byte" ;;
ub ) formatText="unsigned byte" ;;
uw ) formatText="unsigned word" ;;
- raw) formatText="float"; formatFlags="-f -l" ;;
+ raw) formatText="float"; formatFlags="-f -4" ;;
Raw) formatText="double"; formatFlags="-f -8" ;;
au ) formatFlags="-s" ;;
- Wav) formatFlags="-u -b" ;;
+ Wav) formatFlags="-u -1" ;;
sbX ) formatText="signed byte (swap bits)"; formatExt="sb"; formatFlags="-X" ;;
sbN ) formatText="signed byte (swap nibbles)"; formatExt="sb"; formatFlags="-N" ;;
sbXN ) formatText="signed byte (swap nibbles and bits)"; formatExt="sb"; formatFlags="-X -N" ;;
--- a/src/util.c
+++ b/src/util.c
@@ -20,7 +20,7 @@
#endif
sox_output_message_handler_t sox_output_message_handler = NULL;
-int sox_output_verbosity_level = 2;
+unsigned sox_output_verbosity_level = 2;
void sox_output_message(FILE *file, const char *filename, const char *fmt, va_list ap)
{