ref: 27f834ac163241a5ebb09a7952d8b704b30e1a60
parent: dd60a438af3d3a551ab2949f58244c6b3f052d0c
author: cbagwell <cbagwell>
date: Thu Oct 23 22:15:25 EDT 2008
Renamed some internal routines back to lsx_ even though sox.c use them.
--- a/src/adpcms.c
+++ b/src/adpcms.c
@@ -222,7 +222,7 @@
int lsx_adpcm_stopread(sox_format_t * ft UNUSED, adpcm_io_t * state)
{
if (state->encoder.errors)
- sox_warn("%s: ADPCM state errors: %u", ft->filename, state->encoder.errors);
+ lsx_warn("%s: ADPCM state errors: %u", ft->filename, state->encoder.errors);
free(state->file.buf);
return (SOX_SUCCESS);
--- a/src/aiff.c
+++ b/src/aiff.c
@@ -365,7 +365,7 @@
}
/* SSND chunk just read */
if (blocksize != 0)
- sox_warn("AIFF header has invalid blocksize. Ignoring but expect a premature EOF");
+ lsx_warn("AIFF header has invalid blocksize. Ignoring but expect a premature EOF");
while (offset-- > 0) {
if (lsx_readb(ft, &trash8) == SOX_EOF)
@@ -379,7 +379,7 @@
ft->signal.channels = channels;
ft->signal.rate = rate;
if (ft->encoding.encoding != SOX_ENCODING_UNKNOWN && ft->encoding.encoding != SOX_ENCODING_SIGN2)
- sox_report("AIFF only supports signed data. Forcing to signed.");
+ lsx_report("AIFF only supports signed data. Forcing to signed.");
ft->encoding.encoding = SOX_ENCODING_SIGN2;
if (bits <= 8)
ft->encoding.bits_per_sample = 8;
@@ -399,8 +399,8 @@
|| (ft->signal.rate == 0)
|| (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
|| (ft->encoding.bits_per_sample == 0)) {
- sox_report("You must specify # channels, sample rate, signed/unsigned,");
- sox_report("and 8/16 on the command line.");
+ lsx_report("You must specify # channels, sample rate, signed/unsigned,");
+ lsx_report("and 8/16 on the command line.");
lsx_fail_errno(ft,SOX_EFMT,"Bogus AIFF file: no COMM section.");
return(SOX_EOF);
}
@@ -482,24 +482,24 @@
unsigned loopNum;
if(ft->oob.instr.nloops > 0)
- sox_report("AIFF Loop markers:");
+ lsx_report("AIFF Loop markers:");
for(loopNum = 0; loopNum < ft->oob.instr.nloops; loopNum++) {
if (ft->oob.loops[loopNum].count) {
- sox_report("Loop %d: start: %6lu", loopNum, (unsigned long)ft->oob.loops[loopNum].start);
- sox_report(" end: %6lu",
+ lsx_report("Loop %d: start: %6lu", loopNum, (unsigned long)ft->oob.loops[loopNum].start);
+ lsx_report(" end: %6lu",
(unsigned long)(ft->oob.loops[loopNum].start + ft->oob.loops[loopNum].length));
- sox_report(" count: %6d", ft->oob.loops[loopNum].count);
- sox_report(" type: ");
+ lsx_report(" count: %6d", ft->oob.loops[loopNum].count);
+ lsx_report(" type: ");
switch(ft->oob.loops[loopNum].type & ~SOX_LOOP_SUSTAIN_DECAY) {
- case 0: sox_report("off"); break;
- case 1: sox_report("forward"); break;
- case 2: sox_report("forward/backward"); break;
+ case 0: lsx_report("off"); break;
+ case 1: lsx_report("forward"); break;
+ case 2: lsx_report("forward/backward"); break;
}
}
}
- sox_report("Unity MIDI Note: %d", ft->oob.instr.MIDInote);
- sox_report("Low MIDI Note: %d", ft->oob.instr.MIDIlow);
- sox_report("High MIDI Note: %d", ft->oob.instr.MIDIhi);
+ lsx_report("Unity MIDI Note: %d", ft->oob.instr.MIDInote);
+ lsx_report("Low MIDI Note: %d", ft->oob.instr.MIDIlow);
+ lsx_report("High MIDI Note: %d", ft->oob.instr.MIDIhi);
}
/* Process a text chunk, allocate memory, display it if verbose and return */
@@ -599,7 +599,7 @@
len = aiff->nsamples;
done = lsx_rawread(ft, buf, len);
if (done == 0 && aiff->nsamples != 0)
- sox_warn("Premature EOF on AIFF input file");
+ lsx_warn("Premature EOF on AIFF input file");
aiff->nsamples -= done;
return done;
}
@@ -621,10 +621,10 @@
if (lsx_eof(ft))
break;
buf[4] = '\0';
- sox_warn("Ignoring AIFF tail chunk: '%s', %u bytes long",
+ lsx_warn("Ignoring AIFF tail chunk: '%s', %u bytes long",
buf, chunksize);
if (! strcmp(buf, "MARK") || ! strcmp(buf, "INST"))
- sox_warn(" You're stripping MIDI/loop info!");
+ lsx_warn(" You're stripping MIDI/loop info!");
while (chunksize-- > 0)
{
if (lsx_readb(ft, &trash) == SOX_EOF)
--- a/src/alsa.c
+++ b/src/alsa.c
@@ -23,7 +23,7 @@
{
if (ft->encoding.bits_per_sample != 16)
{
- sox_report("trying for word samples.");
+ lsx_report("trying for word samples.");
ft->encoding.bits_per_sample = 16;
}
@@ -33,13 +33,13 @@
if (ft->encoding.bits_per_sample == 16)
{
if (ft->encoding.encoding != SOX_ENCODING_UNKNOWN)
- sox_report("driver supports only signed and unsigned samples. Changing to signed.");
+ lsx_report("driver supports only signed and unsigned samples. Changing to signed.");
ft->encoding.encoding = SOX_ENCODING_SIGN2;
}
else
{
if (ft->encoding.encoding != SOX_ENCODING_UNKNOWN)
- sox_report("driver supports only signed and unsigned samples. Changing to unsigned.");
+ lsx_report("driver supports only signed and unsigned samples. Changing to unsigned.");
ft->encoding.encoding = SOX_ENCODING_UNSIGNED;
}
}
@@ -50,7 +50,7 @@
if (!(snd_pcm_format_mask_test(fmask, SND_PCM_FORMAT_U8)) &&
!(snd_pcm_format_mask_test(fmask, SND_PCM_FORMAT_S8)))
{
- sox_report("driver doesn't supported byte samples. Changing to words.");
+ lsx_report("driver doesn't supported byte samples. Changing to words.");
ft->encoding.bits_per_sample = 16;
}
}
@@ -59,7 +59,7 @@
if (!(snd_pcm_format_mask_test(fmask, SND_PCM_FORMAT_U16)) &&
!(snd_pcm_format_mask_test(fmask, SND_PCM_FORMAT_S16)))
{
- sox_report("driver doesn't supported word samples. Changing to bytes.");
+ lsx_report("driver doesn't supported word samples. Changing to bytes.");
ft->encoding.bits_per_sample = 8;
}
}
@@ -68,12 +68,12 @@
if ((snd_pcm_format_mask_test(fmask, SND_PCM_FORMAT_U16)) ||
(snd_pcm_format_mask_test(fmask, SND_PCM_FORMAT_S16)))
{
- sox_report("driver doesn't supported %u-bit samples. Changing to 16-bit.", ft->encoding.bits_per_sample);
+ lsx_report("driver doesn't supported %u-bit samples. Changing to 16-bit.", ft->encoding.bits_per_sample);
ft->encoding.bits_per_sample = 16;
}
else
{
- sox_report("driver doesn't supported %u-bit samples. Changing to 8-bit.", ft->encoding.bits_per_sample);
+ lsx_report("driver doesn't supported %u-bit samples. Changing to 8-bit.", ft->encoding.bits_per_sample);
ft->encoding.bits_per_sample = 8;
}
}
@@ -84,7 +84,7 @@
case SOX_ENCODING_SIGN2:
if (!(snd_pcm_format_mask_test(fmask, SND_PCM_FORMAT_S8)))
{
- sox_report("driver doesn't supported signed byte samples. Changing to unsigned bytes.");
+ lsx_report("driver doesn't supported signed byte samples. Changing to unsigned bytes.");
ft->encoding.encoding = SOX_ENCODING_UNSIGNED;
}
break;
@@ -91,7 +91,7 @@
case SOX_ENCODING_UNSIGNED:
if (!(snd_pcm_format_mask_test(fmask, SND_PCM_FORMAT_U8)))
{
- sox_report("driver doesn't supported unsigned byte samples. Changing to signed bytes.");
+ lsx_report("driver doesn't supported unsigned byte samples. Changing to signed bytes.");
ft->encoding.encoding = SOX_ENCODING_SIGN2;
}
break;
@@ -126,7 +126,7 @@
case SOX_ENCODING_SIGN2:
if (!(snd_pcm_format_mask_test(fmask, SND_PCM_FORMAT_S16)))
{
- sox_report("driver does not support signed word samples. Changing to unsigned words.");
+ lsx_report("driver does not support signed word samples. Changing to unsigned words.");
ft->encoding.encoding = SOX_ENCODING_UNSIGNED;
}
break;
@@ -133,7 +133,7 @@
case SOX_ENCODING_UNSIGNED:
if (!(snd_pcm_format_mask_test(fmask, SND_PCM_FORMAT_U16)))
{
- sox_report("driver does not support unsigned word samples. Changing to signed words.");
+ lsx_report("driver does not support unsigned word samples. Changing to signed words.");
ft->encoding.encoding = SOX_ENCODING_SIGN2;
}
break;
@@ -259,7 +259,7 @@
if (rate != ft->signal.rate)
{
if (client_signal.rate != 0)
- sox_report("hardware does not support sample rate %g; changing to %i.", ft->signal.rate, rate);
+ lsx_report("hardware does not support sample rate %g; changing to %i.", ft->signal.rate, rate);
ft->signal.rate = rate;
}
dir = 0;
@@ -277,7 +277,7 @@
if (rate != ft->signal.rate)
{
- sox_report("Could not set exact rate of %g. Approximating with %i",
+ lsx_report("Could not set exact rate of %g. Approximating with %i",
ft->signal.rate, rate);
}
@@ -394,7 +394,7 @@
{ /* over/under-run */
err = snd_pcm_prepare(handle);
if (err < 0)
- sox_warn("Can't recover from over/underrun, prepare failed: %s", snd_strerror(err));
+ lsx_warn("Can't recover from over/underrun, prepare failed: %s", snd_strerror(err));
return 0;
}
else
@@ -408,7 +408,7 @@
{
err = snd_pcm_prepare(handle);
if (err < 0)
- sox_warn("Can't recovery from suspend, prepare failed: %s", snd_strerror(err));
+ lsx_warn("Can't recovery from suspend, prepare failed: %s", snd_strerror(err));
}
}
return 0;
--- a/src/ao.c
+++ b/src/ao.c
@@ -51,7 +51,7 @@
if (strcmp(ft->filename,"default") == 0)
{
if ((ao->driver_id = ao_default_driver_id()) < 0) {
- sox_fail("Could not find a default ao driver");
+ lsx_fail("Could not find a default ao driver");
return SOX_EOF;
}
}
@@ -58,7 +58,7 @@
else
{
if ((ao->driver_id = ao_driver_id(ft->filename)) < 0) {
- sox_fail("Could not find a ao driver %s", ft->filename);
+ lsx_fail("Could not find a ao driver %s", ft->filename);
return SOX_EOF;
}
}
@@ -68,7 +68,7 @@
ao->format.channels = ft->signal.channels;
ao->format.byte_format = AO_FMT_NATIVE;
if ((ao->device = ao_open_live(ao->driver_id, &ao->format, NULL)) == NULL) {
- sox_fail("Could not open device: error %d", errno);
+ lsx_fail("Could not open device: error %d", errno);
return SOX_EOF;
}
@@ -112,7 +112,7 @@
free(ao->buf);
if (ao_close(ao->device) == 0) {
- sox_fail("Error closing libao output");
+ lsx_fail("Error closing libao output");
return SOX_EOF;
}
ao_shutdown();
--- a/src/au.c
+++ b/src/au.c
@@ -142,7 +142,7 @@
lsx_fail_errno(ft, SOX_EHDR, "au: can't find Sun/NeXT/DEC identifier");
return SOX_EOF;
}
- sox_report("found %s identifier", id[i].desc);
+ lsx_report("found %s identifier", id[i].desc);
ft->encoding.reverse_bytes = id[i].reverse_bytes;
if (lsx_readdw(ft, &hdr_size) ||
@@ -157,7 +157,7 @@
return SOX_EOF;
}
if (hdr_size < FIXED_HDR + 4)
- sox_warn("header size %u is too small", hdr_size);
+ lsx_warn("header size %u is too small", hdr_size);
if (!(encoding = sox_enc(ft_encoding, &bits_per_sample))) {
int n = min(ft_encoding, Unknown_other);
--- a/src/bend.c
+++ b/src/bend.c
@@ -104,7 +104,7 @@
while ((c = getopt(argc, argv, opts)) != -1) switch (c) {
GETOPT_NUMERIC('f', frame_rate, 10 , 80)
GETOPT_NUMERIC('o', ovsamp, 4 , 32)
- default: sox_fail("unknown option `-%c'", optopt); return lsx_usage(effp);
+ default: lsx_fail("unknown option `-%c'", optopt); return lsx_usage(effp);
}
argc -= optind, argv += optind;
@@ -275,7 +275,7 @@
priv_t *p = (priv_t *) effp->priv;
if (p->bends_pos != p->nbends)
- sox_warn("Input audio too short; bends not applied: %u",
+ lsx_warn("Input audio too short; bends not applied: %u",
p->nbends - p->bends_pos);
return SOX_SUCCESS;
}
--- a/src/biquad.h
+++ b/src/biquad.h
@@ -74,7 +74,7 @@
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
-#define sox_fail sox_globals.subsystem=effp->handler.name,sox_fail
+#undef lsx_fail
+#define lsx_fail sox_globals.subsystem=effp->handler.name,lsx_fail
#endif
--- a/src/biquads.c
+++ b/src/biquads.c
@@ -167,7 +167,7 @@
double alpha = 0;
if (w0 > M_PI) {
- sox_fail("frequency must be less than half the sample-rate (Nyquist rate)");
+ lsx_fail("frequency must be less than half the sample-rate (Nyquist rate)");
return SOX_EOF;
}
@@ -277,7 +277,7 @@
case filter_deemph: /* See deemph.plt for documentation */
if (effp->in_signal.rate != 44100) {
- sox_fail("Sample rate must be 44100 (audio-CD)");
+ lsx_fail("Sample rate must be 44100 (audio-CD)");
return SOX_EOF;
}
/* Falls through... */
@@ -356,7 +356,7 @@
make_poly_from_roots(poles, 2, &p->a0);
}
else {
- sox_fail("Sample rate must be 44.1k, 48k, 88.2k, or 96k");
+ lsx_fail("Sample rate must be 44.1k, 48k, 88.2k, or 96k");
return SOX_EOF;
}
{double g = dB_to_linear(19.9 - linear_to_dB(
--- a/src/chorus.c
+++ b/src/chorus.c
@@ -105,7 +105,7 @@
while ( i < n ) {
if ( chorus->num_chorus > MAX_CHORUS )
{
- sox_fail("chorus: to many delays, use less than %i delays", MAX_CHORUS);
+ lsx_fail("chorus: to many delays, use less than %i delays", MAX_CHORUS);
return (SOX_EOF);
}
sscanf(argv[i++], "%f", &chorus->delay[chorus->num_chorus]);
@@ -137,17 +137,17 @@
if ( chorus->in_gain < 0.0 )
{
- sox_fail("chorus: gain-in must be positive!");
+ lsx_fail("chorus: gain-in must be positive!");
return (SOX_EOF);
}
if ( chorus->in_gain > 1.0 )
{
- sox_fail("chorus: gain-in must be less than 1.0!");
+ lsx_fail("chorus: gain-in must be less than 1.0!");
return (SOX_EOF);
}
if ( chorus->out_gain < 0.0 )
{
- sox_fail("chorus: gain-out must be positive!");
+ lsx_fail("chorus: gain-out must be positive!");
return (SOX_EOF);
}
for ( i = 0; i < chorus->num_chorus; i++ ) {
@@ -158,42 +158,42 @@
if ( chorus->delay[i] < 20.0 )
{
- sox_fail("chorus: delay must be more than 20.0 msec!");
+ lsx_fail("chorus: delay must be more than 20.0 msec!");
return (SOX_EOF);
}
if ( chorus->delay[i] > 100.0 )
{
- sox_fail("chorus: delay must be less than 100.0 msec!");
+ lsx_fail("chorus: delay must be less than 100.0 msec!");
return (SOX_EOF);
}
if ( chorus->speed[i] < 0.1 )
{
- sox_fail("chorus: speed must be more than 0.1 Hz!");
+ lsx_fail("chorus: speed must be more than 0.1 Hz!");
return (SOX_EOF);
}
if ( chorus->speed[i] > 5.0 )
{
- sox_fail("chorus: speed must be less than 5.0 Hz!");
+ lsx_fail("chorus: speed must be less than 5.0 Hz!");
return (SOX_EOF);
}
if ( chorus->depth[i] < 0.0 )
{
- sox_fail("chorus: delay must be more positive!");
+ lsx_fail("chorus: delay must be more positive!");
return (SOX_EOF);
}
if ( chorus->depth[i] > 10.0 )
{
- sox_fail("chorus: delay must be less than 10.0 msec!");
+ lsx_fail("chorus: delay must be less than 10.0 msec!");
return (SOX_EOF);
}
if ( chorus->decay[i] < 0.0 )
{
- sox_fail("chorus: decay must be positive!" );
+ lsx_fail("chorus: decay must be positive!" );
return (SOX_EOF);
}
if ( chorus->decay[i] > 1.0 )
{
- sox_fail("chorus: decay must be less that 1.0!" );
+ lsx_fail("chorus: decay must be less that 1.0!" );
return (SOX_EOF);
}
chorus->length[i] = effp->in_signal.rate / chorus->speed[i];
@@ -218,7 +218,7 @@
for ( i = 0; i < chorus->num_chorus; i++ )
sum_in_volume += chorus->decay[i];
if ( chorus->in_gain * ( sum_in_volume ) > 1.0 / chorus->out_gain )
- sox_warn("chorus: warning >>> gain-out can cause saturation or clipping of output <<<");
+ lsx_warn("chorus: warning >>> gain-out can cause saturation or clipping of output <<<");
chorus->chorusbuf = lsx_malloc(sizeof (float) * chorus->maxsamples);
--- a/src/compand.c
+++ b/src/compand.c
@@ -73,7 +73,7 @@
/* Start by checking the attack and decay rates */
for (s = argv[0], commas = 0; *s; ++s) if (*s == ',') ++commas;
if ((commas % 2) == 0) {
- sox_fail("there must be an even number of attack/decay parameters");
+ lsx_fail("there must be an even number of attack/decay parameters");
return SOX_EOF;
}
pairs = 1 + commas/2;
@@ -85,10 +85,10 @@
for (i = 0, s = strtok(argv[0], ","); s != NULL; ++i) {
for (j = 0; j < 2; ++j) {
if (sscanf(s, "%lf %c", &l->channels[i].attack_times[j], &dummy) != 1) {
- sox_fail("syntax error trying to read attack/decay time");
+ lsx_fail("syntax error trying to read attack/decay time");
return SOX_EOF;
} else if (l->channels[i].attack_times[j] < 0) {
- sox_fail("attack & decay times can't be less than 0 seconds");
+ lsx_fail("attack & decay times can't be less than 0 seconds");
return SOX_EOF;
}
s = strtok(NULL, ",");
@@ -104,10 +104,10 @@
for (i = 0; i < l->expectedChannels; ++i) {
double init_vol_dB = 0;
if (n > 3 && sscanf(argv[3], "%lf %c", &init_vol_dB, &dummy) != 1) {
- sox_fail("syntax error trying to read initial volume");
+ lsx_fail("syntax error trying to read initial volume");
return SOX_EOF;
} else if (init_vol_dB > 0) {
- sox_fail("initial volume is relative to maximum volume so can't exceed 0dB");
+ lsx_fail("initial volume is relative to maximum volume so can't exceed 0dB");
return SOX_EOF;
}
l->channels[i].volume = pow(10., init_vol_dB / 20);
@@ -115,10 +115,10 @@
/* If there is a delay, store it. */
if (n > 4 && sscanf(argv[4], "%lf %c", &l->delay, &dummy) != 1) {
- sox_fail("syntax error trying to read delay value");
+ lsx_fail("syntax error trying to read delay value");
return SOX_EOF;
} else if (l->delay < 0) {
- sox_fail("delay can't be less than 0 seconds");
+ lsx_fail("delay can't be less than 0 seconds");
return SOX_EOF;
}
--- a/src/compandt.c
+++ b/src/compandt.c
@@ -143,11 +143,11 @@
if (!strcmp(text, "-inf"))
*value = -20 * log10(-(double)SOX_SAMPLE_MIN);
else if (sscanf(text, "%lf %c", value, &dummy) != 1) {
- sox_fail("syntax error trying to read transfer function value");
+ lsx_fail("syntax error trying to read transfer function value");
return sox_false;
}
else if (*value > 0) {
- sox_fail("transfer function values are relative to maximum volume so can't exceed 0dB");
+ lsx_fail("transfer function values are relative to maximum volume so can't exceed 0dB");
return sox_false;
}
return sox_true;
@@ -176,7 +176,7 @@
if (!parse_transfer_value(text, &s(i).x))
return sox_false;
if (i && s(i-1).x > s(i).x) {
- sox_fail("transfer function input values must be strictly increasing");
+ lsx_fail("transfer function input values must be strictly increasing");
return sox_false;
}
if (i || (commas & 1)) {
@@ -194,7 +194,7 @@
#undef s
if (gain && sscanf(gain, "%lf %c", &t->outgain_dB, &dummy) != 1) {
- sox_fail("syntax error trying to read post-processing gain value");
+ lsx_fail("syntax error trying to read post-processing gain value");
return sox_false;
}
--- a/src/cvsd.c
+++ b/src/cvsd.c
@@ -100,7 +100,7 @@
p->bytes_written = 0;
p->com.v_min = 1;
p->com.v_max = -1;
- sox_report("cvsd: bit rate %dbit/s, bits from %s", p->cvsd_rate,
+ lsx_report("cvsd: bit rate %dbit/s, bits from %s", p->cvsd_rate,
ft->encoding.reverse_bits ? "msb to lsb" : "lsb to msb");
}
@@ -385,7 +385,7 @@
hdr->Crc = get16_le(&pch);
if (sum != hdr->Crc)
{
- sox_report("DVMS header checksum error, read %u, calculated %u",
+ lsx_report("DVMS header checksum error, read %u, calculated %u",
hdr->Crc, sum);
return (SOX_EOF);
}
@@ -427,12 +427,12 @@
put16_le(&pch, hdr->Crc);
if (lsx_seeki(ft, (off_t)0, SEEK_SET) < 0)
{
- sox_report("seek failed\n: %s",strerror(errno));
+ lsx_report("seek failed\n: %s",strerror(errno));
return (SOX_EOF);
}
if (lsx_writebuf(ft, hdrbuf, sizeof(hdrbuf)) != sizeof(hdrbuf))
{
- sox_report("%s",strerror(errno));
+ lsx_report("%s",strerror(errno));
return (SOX_EOF);
}
return (SOX_SUCCESS);
@@ -522,7 +522,7 @@
}
if (!ft->seekable)
- sox_warn("Length in output .DVMS header will wrong since can't seek to fix it");
+ lsx_warn("Length in output .DVMS header will wrong since can't seek to fix it");
return(SOX_SUCCESS);
}
@@ -537,7 +537,7 @@
lsx_cvsdstopwrite(ft);
if (!ft->seekable)
{
- sox_warn("File not seekable");
+ lsx_warn("File not seekable");
return (SOX_EOF);
}
if (lsx_seeki(ft, (off_t)0, 0) != 0)
--- a/src/dcshift.c
+++ b/src/dcshift.c
@@ -148,7 +148,7 @@
if (dcs->limited)
{
- sox_warn("DCSHIFT limited %d values (%d percent).",
+ lsx_warn("DCSHIFT limited %d values (%d percent).",
dcs->limited, (int) (dcs->limited * 100.0 / dcs->totalprocessed));
}
if (dcs->clipped)
@@ -155,12 +155,12 @@
{
if (dcs->dcshift > 0)
{
- sox_warn("DCSHIFT clipped %d values, dcshift=%f too high...",
+ lsx_warn("DCSHIFT clipped %d values, dcshift=%f too high...",
dcs->clipped, dcs->dcshift);
}
else
{
- sox_warn("DCSHIFT clipped %d values, dcshift=%f too low...",
+ lsx_warn("DCSHIFT clipped %d values, dcshift=%f too low...",
dcs->clipped, dcs->dcshift);
}
}
--- a/src/earwax.c
+++ b/src/earwax.c
@@ -58,7 +58,7 @@
{
priv_t * p = (priv_t *)effp->priv;
if (effp->in_signal.rate != 44100 || effp->in_signal.channels != 2) {
- sox_fail("works only with stereo audio sampled at 44100Hz (i.e. CDDA)");
+ lsx_fail("works only with stereo audio sampled at 44100Hz (i.e. CDDA)");
return SOX_EOF;
}
memset(p->tap, 0, NUMTAPS * sizeof(*p->tap)); /* zero tap memory */
--- a/src/echo.c
+++ b/src/echo.c
@@ -82,7 +82,7 @@
sscanf(argv[i++], "%f", &echo->out_gain);
while (i < n) {
if ( echo->num_delays >= MAX_ECHOS )
- sox_fail("echo: to many delays, use less than %i delays",
+ lsx_fail("echo: to many delays, use less than %i delays",
MAX_ECHOS);
/* Linux bug and it's cleaner. */
sscanf(argv[i++], "%f", &echo->delay[echo->num_delays]);
@@ -105,17 +105,17 @@
echo->maxsamples = 0;
if ( echo->in_gain < 0.0 )
{
- sox_fail("echo: gain-in must be positive!");
+ lsx_fail("echo: gain-in must be positive!");
return (SOX_EOF);
}
if ( echo->in_gain > 1.0 )
{
- sox_fail("echo: gain-in must be less than 1.0!");
+ lsx_fail("echo: gain-in must be less than 1.0!");
return (SOX_EOF);
}
if ( echo->out_gain < 0.0 )
{
- sox_fail("echo: gain-in must be positive!");
+ lsx_fail("echo: gain-in must be positive!");
return (SOX_EOF);
}
for ( i = 0; i < echo->num_delays; i++ ) {
@@ -122,23 +122,23 @@
echo->samples[i] = echo->delay[i] * effp->in_signal.rate / 1000.0;
if ( echo->samples[i] < 1 )
{
- sox_fail("echo: delay must be positive!");
+ lsx_fail("echo: delay must be positive!");
return (SOX_EOF);
}
if ( echo->samples[i] > (ptrdiff_t)DELAY_BUFSIZ )
{
- sox_fail("echo: delay must be less than %g seconds!",
+ lsx_fail("echo: delay must be less than %g seconds!",
DELAY_BUFSIZ / effp->in_signal.rate );
return (SOX_EOF);
}
if ( echo->decay[i] < 0.0 )
{
- sox_fail("echo: decay must be positive!" );
+ lsx_fail("echo: decay must be positive!" );
return (SOX_EOF);
}
if ( echo->decay[i] > 1.0 )
{
- sox_fail("echo: decay must be less than 1.0!" );
+ lsx_fail("echo: decay must be less than 1.0!" );
return (SOX_EOF);
}
if ( echo->samples[i] > echo->maxsamples )
@@ -152,7 +152,7 @@
for ( i = 0; i < echo->num_delays; i++ )
sum_in_volume += echo->decay[i];
if ( sum_in_volume * echo->in_gain > 1.0 / echo->out_gain )
- sox_warn("echo: warning >>> gain-out can cause saturation of output <<<");
+ lsx_warn("echo: warning >>> gain-out can cause saturation of output <<<");
echo->counter = 0;
echo->fade_out = echo->maxsamples;
return (SOX_SUCCESS);
--- a/src/echos.c
+++ b/src/echos.c
@@ -82,7 +82,7 @@
echos->num_delays++;
if ( echos->num_delays > MAX_ECHOS )
{
- sox_fail("echos: to many delays, use less than %i delays",
+ lsx_fail("echos: to many delays, use less than %i delays",
MAX_ECHOS);
return (SOX_EOF);
}
@@ -103,17 +103,17 @@
if ( echos->in_gain < 0.0 )
{
- sox_fail("echos: gain-in must be positive!");
+ lsx_fail("echos: gain-in must be positive!");
return (SOX_EOF);
}
if ( echos->in_gain > 1.0 )
{
- sox_fail("echos: gain-in must be less than 1.0!");
+ lsx_fail("echos: gain-in must be less than 1.0!");
return (SOX_EOF);
}
if ( echos->out_gain < 0.0 )
{
- sox_fail("echos: gain-in must be positive!");
+ lsx_fail("echos: gain-in must be positive!");
return (SOX_EOF);
}
for ( i = 0; i < echos->num_delays; i++ ) {
@@ -120,23 +120,23 @@
echos->samples[i] = echos->delay[i] * effp->in_signal.rate / 1000.0;
if ( echos->samples[i] < 1 )
{
- sox_fail("echos: delay must be positive!");
+ lsx_fail("echos: delay must be positive!");
return (SOX_EOF);
}
if ( echos->samples[i] > (ptrdiff_t)DELAY_BUFSIZ )
{
- sox_fail("echos: delay must be less than %g seconds!",
+ lsx_fail("echos: delay must be less than %g seconds!",
DELAY_BUFSIZ / effp->in_signal.rate );
return (SOX_EOF);
}
if ( echos->decay[i] < 0.0 )
{
- sox_fail("echos: decay must be positive!" );
+ lsx_fail("echos: decay must be positive!" );
return (SOX_EOF);
}
if ( echos->decay[i] > 1.0 )
{
- sox_fail("echos: decay must be less than 1.0!" );
+ lsx_fail("echos: decay must be less than 1.0!" );
return (SOX_EOF);
}
echos->counter[i] = 0;
@@ -151,7 +151,7 @@
for ( i = 0; i < echos->num_delays; i++ )
sum_in_volume += echos->decay[i];
if ( sum_in_volume * echos->in_gain > 1.0 / echos->out_gain )
- sox_warn("echos: warning >>> gain-out can cause saturation of output <<<");
+ lsx_warn("echos: warning >>> gain-out can cause saturation of output <<<");
return (SOX_SUCCESS);
}
--- a/src/effects.c
+++ b/src/effects.c
@@ -24,10 +24,10 @@
#endif
-#undef sox_fail
-#undef sox_report
-#define sox_fail sox_globals.subsystem=effp->handler.name,sox_fail
-#define sox_report sox_globals.subsystem=effp->handler.name,sox_report
+#undef lsx_fail
+#undef lsx_report
+#define lsx_fail sox_globals.subsystem=effp->handler.name,lsx_fail
+#define lsx_report sox_globals.subsystem=effp->handler.name,lsx_report
#define DEBUG_EFFECTS_CHAIN 0
@@ -117,7 +117,7 @@
int lsx_effect_set_imin(sox_effect_t * effp, size_t imin)
{
if (imin > sox_globals.bufsiz / effp->flows) {
- sox_fail("sox_bufsiz not big enough");
+ lsx_fail("sox_bufsiz not big enough");
return SOX_EOF;
}
@@ -138,7 +138,7 @@
sox_effect_t eff0; /* Copy of effect for flow 0 before calling start */
if (effp->handler.flags & SOX_EFF_NULL) {
- sox_report("has no effect (is a proxy effect)");
+ lsx_report("has no effect (is a proxy effect)");
return SOX_SUCCESS;
}
effp->global_info = &chain->global_info;
@@ -161,7 +161,7 @@
eff0.priv = lsx_memdup(eff0.priv, eff0.handler.priv_size);
ret = start(effp);
if (ret == SOX_EFF_NULL) {
- sox_report("has no effect in this configuration");
+ lsx_report("has no effect in this configuration");
free(eff0.priv);
return SOX_SUCCESS;
}
@@ -173,7 +173,7 @@
*in = effp->out_signal;
if (chain->length == SOX_MAX_EFFECTS) {
- sox_fail("Too many effects!");
+ lsx_fail("Too many effects!");
free(eff0.priv);
return SOX_EOF;
}
@@ -228,7 +228,7 @@
int eff_status_c = effp->handler.flow(&chain->effects[n][f],
chain->ibufc[f], chain->obufc[f], &idonec, &odonec);
if (f && (idonec != idone_last || odonec != odone_last)) {
- sox_fail("flowed asymmetrically!");
+ lsx_fail("flowed asymmetrically!");
effstatus = SOX_EOF;
}
idone_last = idonec;
@@ -246,7 +246,7 @@
obeg = f * odone_last;
}
#if DEBUG_EFFECTS_CHAIN
- sox_report("flow: %5u%5u%5u%5u", pre_idone, pre_odone, idone, obeg);
+ lsx_report("flow: %5u%5u%5u%5u", pre_idone, pre_odone, idone, obeg);
#endif
effp1->obeg += idone;
if (effp1->obeg == effp1->oend)
@@ -283,7 +283,7 @@
size_t odonec = obeg / effp->flows;
int eff_status_c = effp->handler.drain(&chain->effects[n][f], chain->obufc[f], &odonec);
if (f && (odonec != odone_last)) {
- sox_fail("drained asymmetrically!");
+ lsx_fail("drained asymmetrically!");
effstatus = SOX_EOF;
}
odone_last = odonec;
@@ -298,7 +298,7 @@
obeg = f * odone_last;
}
#if DEBUG_EFFECTS_CHAIN
- sox_report("drain: %5u%5u%5u%5u", 0, pre_odone, 0, obeg);
+ lsx_report("drain: %5u%5u%5u%5u", 0, pre_odone, 0, obeg);
#endif
if (!obeg) /* This is the only thing that drain has and flow hasn't */
effstatus = SOX_EOF;
@@ -422,7 +422,7 @@
unsigned f;
if ((clips = sox_stop_effect(effp)) != 0)
- sox_warn("%s clipped %lu samples; decrease volume?",
+ lsx_warn("%s clipped %lu samples; decrease volume?",
effp->handler.name, (unsigned long)clips);
effp->handler.kill(effp); /* N.B. only one kill; not one per flow */
for (f = 0; f < effp->flows; ++f)
--- a/src/effects_i.c
+++ b/src/effects_i.c
@@ -26,15 +26,15 @@
#include <assert.h>
#include <string.h>
-#undef sox_fail
-#define sox_fail sox_globals.subsystem=effp->handler.name,sox_fail
+#undef lsx_fail
+#define lsx_fail sox_globals.subsystem=effp->handler.name,lsx_fail
int lsx_usage(sox_effect_t * effp)
{
if (effp->handler.usage)
- sox_fail("usage: %s", effp->handler.usage);
+ lsx_fail("usage: %s", effp->handler.usage);
else
- sox_fail("this effect takes no parameters");
+ lsx_fail("this effect takes no parameters");
return SOX_EOF;
}
@@ -118,9 +118,9 @@
((a * a * a - a) * y_2d[i[0]] + (b * b * b - b) * y_2d[i[1]]) * d * d / 6;
}
-sox_enum_item const lsx_wave_enum[] = {
- ENUM_ITEM(SOX_WAVE_,SINE)
- ENUM_ITEM(SOX_WAVE_,TRIANGLE)
+lsx_enum_item const lsx_wave_enum[] = {
+ LSX_ENUM_ITEM(SOX_WAVE_,SINE)
+ LSX_ENUM_ITEM(SOX_WAVE_,TRIANGLE)
{0, 0}};
void lsx_generate_wave_table(
--- a/src/example2.c
+++ b/src/example2.c
@@ -40,7 +40,7 @@
static const double block_period = 0.025; /* seconds */
double start_secs = 0, period = 2;
char dummy;
- size_t seek;
+ uint64_t seek;
/* All libSoX applications must start by initialising the SoX library */
assert(sox_format_init() == SOX_SUCCESS);
--- a/src/fade.c
+++ b/src/fade.c
@@ -132,7 +132,7 @@
if (!fade->out_stop) {
fade->out_stop = effp->in_signal.length / effp->in_signal.channels;
if (!fade->out_stop) {
- sox_fail("cannot fade out: audio length is neither known nor given");
+ lsx_fail("cannot fade out: audio length is neither known nor given");
return SOX_EOF;
}
}
@@ -163,7 +163,7 @@
/* Sanity check for fade times vs total time */
if (fade->in_stop > fade->out_start && fade->out_start != 0)
{ /* Fades too long */
- sox_fail("Fade: End of fade-in should not happen before beginning of fade-out");
+ lsx_fail("Fade: End of fade-in should not happen before beginning of fade-out");
return(SOX_EOF);
} /* endif fade time sanity */
@@ -275,7 +275,7 @@
if (fade->do_out && fade->samplesdone < fade->out_stop &&
!(fade->endpadwarned))
{ /* Warning about padding silence into end of sample */
- sox_warn("Fade: warning: End time passed end-of-file. Padding with silence");
+ lsx_warn("Fade: warning: End time passed end-of-file. Padding with silence");
fade->endpadwarned = 1;
} /* endif endpadwarned */
--- a/src/ffmpeg.c
+++ b/src/ffmpeg.c
@@ -91,7 +91,7 @@
if (!codec || avcodec_open(enc, codec) < 0)
return -1;
if (enc->codec_type != CODEC_TYPE_AUDIO) {
- sox_fail("ffmpeg CODEC %x is not an audio CODEC", enc->codec_type);
+ lsx_fail("ffmpeg CODEC %x is not an audio CODEC", enc->codec_type);
return -1;
}
@@ -166,13 +166,13 @@
/* Open file and get format */
memset(¶ms, 0, sizeof(params));
if ((ret = av_open_input_file(&ffmpeg->ctxt, ft->filename, NULL, 0, ¶ms)) < 0) {
- sox_fail("ffmpeg cannot open file for reading: %s (code %d)", ft->filename, ret);
+ lsx_fail("ffmpeg cannot open file for reading: %s (code %d)", ft->filename, ret);
return SOX_EOF;
}
/* Get CODEC parameters */
if ((ret = av_find_stream_info(ffmpeg->ctxt)) < 0) {
- sox_fail("ffmpeg could not find CODEC parameters for %s", ft->filename);
+ lsx_fail("ffmpeg could not find CODEC parameters for %s", ft->filename);
return SOX_EOF;
}
@@ -192,7 +192,7 @@
if (ffmpeg->audio_index < 0 ||
stream_component_open(ffmpeg, ffmpeg->audio_index) < 0 ||
ffmpeg->audio_stream < 0) {
- sox_fail("ffmpeg could not open CODECs for %s", ft->filename);
+ lsx_fail("ffmpeg could not open CODECs for %s", ft->filename);
return SOX_EOF;
}
@@ -265,7 +265,7 @@
st = av_new_stream(oc, 1);
if (!st) {
- sox_fail("ffmpeg could not alloc stream");
+ lsx_fail("ffmpeg could not alloc stream");
return NULL;
}
@@ -292,13 +292,13 @@
/* find the audio encoder */
codec = avcodec_find_encoder(c->codec_id);
if (!codec) {
- sox_fail("ffmpeg CODEC not found");
+ lsx_fail("ffmpeg CODEC not found");
return SOX_EOF;
}
/* open it */
if (avcodec_open(c, codec) < 0) {
- sox_fail("ffmpeg could not open CODEC");
+ lsx_fail("ffmpeg could not open CODEC");
return SOX_EOF;
}
@@ -337,10 +337,10 @@
mpeg. */
ffmpeg->fmt = guess_format(NULL, ft->filename, NULL);
if (!ffmpeg->fmt) {
- sox_warn("ffmpeg could not deduce output format from file extension; using MPEG");
+ lsx_warn("ffmpeg could not deduce output format from file extension; using MPEG");
ffmpeg->fmt = guess_format("mpeg", NULL, NULL);
if (!ffmpeg->fmt) {
- sox_fail("ffmpeg could not find suitable output format");
+ lsx_fail("ffmpeg could not find suitable output format");
return SOX_EOF;
}
}
@@ -366,7 +366,7 @@
/* set the output parameters (must be done even if no
parameters). */
if (av_set_parameters(ffmpeg->ctxt, NULL) < 0) {
- sox_fail("ffmpeg invalid output format parameters");
+ lsx_fail("ffmpeg invalid output format parameters");
return SOX_EOF;
}
@@ -382,7 +382,7 @@
/* open the output file, if needed */
if (!(ffmpeg->fmt->flags & AVFMT_NOFILE)) {
if (url_fopen(&ffmpeg->ctxt->pb, ft->filename, URL_WRONLY) < 0) {
- sox_fail("ffmpeg could not open `%s'", ft->filename);
+ lsx_fail("ffmpeg could not open `%s'", ft->filename);
return SOX_EOF;
}
}
@@ -425,7 +425,7 @@
/* write the compressed frame to the media file */
if (av_write_frame(ffmpeg->ctxt, &pkt) != 0)
- sox_fail("ffmpeg had error while writing audio frame");
+ lsx_fail("ffmpeg had error while writing audio frame");
/* Increment nwritten whether write succeeded or not; we have to
get rid of the input! */
--- a/src/filter.c
+++ b/src/filter.c
@@ -188,7 +188,7 @@
if ((n >= 2) && !sscanf(argv[1], "%ld", &f->Nwin))
return lsx_usage(effp);
else if (f->Nwin < 4) {
- sox_fail("filter: window length (%ld) <4 is too short", f->Nwin);
+ lsx_fail("filter: window length (%ld) <4 is too short", f->Nwin);
return (SOX_EOF);
}
@@ -224,7 +224,7 @@
if ((f->freq0 < 0) || (f->freq0 > f->freq1))
{
- sox_fail("filter: low(%g),high(%g) parameters must satisfy 0 <= low <= high <= %g",
+ lsx_fail("filter: low(%g),high(%g) parameters must satisfy 0 <= low <= high <= %g",
f->freq0, f->freq1, f->rate/2);
return (SOX_EOF);
}
@@ -236,7 +236,7 @@
Xh0 = lsx_makeFilter(Fp0, Xh, 2.0*(double)f->freq0/f->rate, f->beta, (size_t) 1, 0);
if (Xh0 <= 1)
{
- sox_fail("filter: Unable to make low filter");
+ lsx_fail("filter: Unable to make low filter");
return (SOX_EOF);
}
} else {
@@ -249,7 +249,7 @@
Xh1 = lsx_makeFilter(Fp1, Xh, 2.0*(double)f->freq1/f->rate, f->beta, (size_t) 1, 0);
if (Xh1 <= 1)
{
- sox_fail("filter: Unable to make high filter");
+ lsx_fail("filter: Unable to make high filter");
return (SOX_EOF);
}
} else {
@@ -270,7 +270,7 @@
Xh -= 1; /* Xh = 0 can only happen if filter was identity 0-Nyquist */
if (Xh<=0)
- sox_warn("filter: adjusted freq %g-%g is identity", f->freq0, f->freq1);
+ lsx_warn("filter: adjusted freq %g-%g is identity", f->freq0, f->freq1);
f->Nwin = 2*Xh + 1; /* not really used afterwards */
f->Xh = Xh;
@@ -415,7 +415,7 @@
*osamp -= osamp_res;
/* lsx_debug("DRAIN osamp %d", *osamp); */
if (isamp_res)
- sox_warn("drain overran obuf by %ld", isamp_res);
+ lsx_warn("drain overran obuf by %ld", isamp_res);
/* FIXME: This is very picky. osamp better be big enough to grab
* all remaining samples or they will be discarded.
*/
--- a/src/flac.c
+++ b/src/flac.c
@@ -90,7 +90,7 @@
return;
if (ft->oob.comments != NULL) {
- sox_warn("multiple Vorbis comment block ignored");
+ lsx_warn("multiple Vorbis comment block ignored");
return;
}
@@ -223,7 +223,7 @@
{
priv_t * p = (priv_t *)ft->priv;
if (!FLAC__stream_decoder_finish(p->decoder) && p->eof)
- sox_warn("decoder MD5 checksum mismatch.");
+ lsx_warn("decoder MD5 checksum mismatch.");
FLAC__stream_decoder_delete(p->decoder);
return SOX_SUCCESS;
}
@@ -306,7 +306,7 @@
p->bits_per_sample = ft->encoding.bits_per_sample;
- sox_report("encoding at %i bits per sample", p->bits_per_sample);
+ lsx_report("encoding at %i bits per sample", p->bits_per_sample);
FLAC__stream_encoder_set_channels(p->encoder, ft->signal.channels);
FLAC__stream_encoder_set_bits_per_sample(p->encoder, p->bits_per_sample);
@@ -320,7 +320,7 @@
for (i = 0; !streamable && i < array_length(streamable_rates); ++i)
streamable = (streamable_rates[i] == ft->signal.rate);
if (!streamable) {
- sox_report("non-standard rate; output may not be streamable");
+ lsx_report("non-standard rate; output may not be streamable");
FLAC__stream_encoder_set_streamable_subset(p->encoder, sox_false);
}
}
@@ -349,7 +349,7 @@
{4608, sox_true, sox_true, sox_false, 12, 6, 0},
};
#define SET_OPTION(x) do {\
- sox_report(#x" = %i", options[compression_level].x); \
+ lsx_report(#x" = %i", options[compression_level].x); \
FLAC__stream_encoder_set_##x(p->encoder, options[compression_level].x);\
} while (0)
SET_OPTION(blocksize);
--- a/src/flanger.c
+++ b/src/flanger.c
@@ -91,9 +91,9 @@
-static sox_enum_item const interp_enum[] = {
- ENUM_ITEM(INTERP_,LINEAR)
- ENUM_ITEM(INTERP_,QUADRATIC)
+static lsx_enum_item const interp_enum[] = {
+ LSX_ENUM_ITEM(INTERP_,LINEAR)
+ LSX_ENUM_ITEM(INTERP_,QUADRATIC)
{0, 0}};
@@ -122,7 +122,7 @@
if (argc != 0)
return lsx_usage(effp);
- sox_report("parameters:\n"
+ lsx_report("parameters:\n"
"delay = %gms\n"
"depth = %gms\n"
"regen = %g%%\n"
@@ -151,7 +151,7 @@
int c, channels = effp->in_signal.channels;
if (channels > MAX_CHANNELS) {
- sox_fail("Can not operate with more than %i channels", MAX_CHANNELS);
+ lsx_fail("Can not operate with more than %i channels", MAX_CHANNELS);
return SOX_EOF;
}
--- a/src/formats.c
+++ b/src/formats.c
@@ -273,20 +273,20 @@
if (ft->handler.flags & SOX_FILE_ENDIAN) {
if (ft->encoding.reverse_bytes == (sox_option_t)
(!(ft->handler.flags & SOX_FILE_ENDBIG) != MACHINE_IS_BIGENDIAN))
- sox_report("`%s': overriding file-type byte-order", ft->filename);
+ lsx_report("`%s': overriding file-type byte-order", ft->filename);
} else if (ft->encoding.reverse_bytes == sox_true)
- sox_report("`%s': overriding machine byte-order", ft->filename);
+ lsx_report("`%s': overriding machine byte-order", ft->filename);
if (ft->encoding.reverse_bits == SOX_OPTION_DEFAULT)
ft->encoding.reverse_bits = !!(ft->handler.flags & SOX_FILE_BIT_REV);
else if (ft->encoding.reverse_bits == !(ft->handler.flags & SOX_FILE_BIT_REV))
- sox_report("`%s': overriding file-type bit-order", ft->filename);
+ lsx_report("`%s': overriding file-type bit-order", ft->filename);
if (ft->encoding.reverse_nibbles == SOX_OPTION_DEFAULT)
ft->encoding.reverse_nibbles = !!(ft->handler.flags & SOX_FILE_NIB_REV);
else
if (ft->encoding.reverse_nibbles == !(ft->handler.flags & SOX_FILE_NIB_REV))
- sox_report("`%s': overriding file-type nibble-order", ft->filename);
+ lsx_report("`%s': overriding file-type nibble-order", ft->filename);
}
static sox_bool is_seekable(sox_format_t const * ft)
@@ -351,7 +351,7 @@
free(command);
*is_process = sox_true;
#else
- sox_fail("this build of SoX cannot open URLs");
+ lsx_fail("this build of SoX cannot open URLs");
#endif
return f;
}
@@ -370,7 +370,7 @@
if (filetype) {
if (!(handler = sox_find_format(filetype, sox_false))) {
- sox_fail("no handler for given file type `%s'", filetype);
+ lsx_fail("no handler for given file type `%s'", filetype);
goto error;
}
ft->handler = *handler;
@@ -382,7 +382,7 @@
if (!strcmp(path, "-")) { /* Use stdin if the filename is "-" */
if (sox_globals.stdin_in_use_by) {
- sox_fail("`-' (stdin) already in use by `%s'", sox_globals.stdin_in_use_by);
+ lsx_fail("`-' (stdin) already in use by `%s'", sox_globals.stdin_in_use_by);
goto error;
}
sox_globals.stdin_in_use_by = "audio input";
@@ -393,12 +393,12 @@
ft->fp = xfopen(path, "rb", &ft->is_process);
url = ft->is_process? " URL" : "";
if (ft->fp == NULL) {
- sox_fail("can't open input file%s `%s': %s", url, path, strerror(errno));
+ lsx_fail("can't open input file%s `%s': %s", url, path, strerror(errno));
goto error;
}
}
if (setvbuf (ft->fp, NULL, _IOFBF, sizeof(char) * input_bufsiz)) {
- sox_fail("Can't set read buffer");
+ lsx_fail("Can't set read buffer");
goto error;
}
ft->seekable = is_seekable(ft);
@@ -406,7 +406,7 @@
if (!filetype) {
if (ft->seekable) {
- filetype = detect_magic(ft, sox_find_file_extension(path));
+ filetype = detect_magic(ft, lsx_find_file_extension(path));
lsx_rewind(ft);
#if HAVE_MAGIC
if (!filetype) {
@@ -426,19 +426,19 @@
#endif
}
if (filetype) {
- sox_report("detected file format type `%s'", filetype);
+ lsx_report("detected file format type `%s'", filetype);
if (!(handler = sox_find_format(filetype, sox_false))) {
- sox_fail("no handler for detected file type `%s'", filetype);
+ lsx_fail("no handler for detected file type `%s'", filetype);
goto error;
}
}
else {
- if (!(filetype = sox_find_file_extension(path))) {
- sox_fail("can't determine type of `%s'", path);
+ if (!(filetype = lsx_find_file_extension(path))) {
+ lsx_fail("can't determine type of `%s'", path);
goto error;
}
if (!(handler = sox_find_format(filetype, sox_true))) {
- sox_fail("no handler for file extension `%s'", filetype);
+ lsx_fail("no handler for file extension `%s'", filetype);
goto error;
}
}
@@ -449,7 +449,7 @@
}
}
if (!ft->handler.startread && !ft->handler.read) {
- sox_fail("file type `%s' isn't readable", filetype);
+ lsx_fail("file type `%s' isn't readable", filetype);
goto error;
}
@@ -467,7 +467,7 @@
ft->priv = lsx_calloc(1, ft->handler.priv_size);
/* Read and write starters can change their formats. */
if (ft->handler.startread && (*ft->handler.startread)(ft) != SOX_SUCCESS) {
- sox_fail("can't open input file%s `%s': %s", url, ft->filename, ft->sox_errstr);
+ lsx_fail("can't open input file%s `%s': %s", url, ft->filename, ft->sox_errstr);
goto error;
}
@@ -479,7 +479,7 @@
if (sox_checkformat(ft) == SOX_SUCCESS)
return ft;
- sox_fail("bad input format for file%s `%s': %s", url, ft->filename, ft->sox_errstr);
+ lsx_fail("bad input format for file%s `%s': %s", url, ft->filename, ft->sox_errstr);
error:
if (ft->fp && ft->fp != stdin)
@@ -505,7 +505,7 @@
assert(path);
assert(encoding);
if (!filetype)
- filetype = sox_find_file_extension(path);
+ filetype = lsx_find_file_extension(path);
if (!filetype || !(handler = sox_find_format(filetype, is_file_extension)) ||
!handler->write_formats)
@@ -551,7 +551,7 @@
}
if (ft->signal.rate == HUGE_VAL)
ft->signal.rate = max;
- sox_warn("%s can't encode at %gHz; using %gHz", ft->handler.names[0], given, ft->signal.rate);
+ lsx_warn("%s can't encode at %gHz; using %gHz", ft->handler.names[0], given, ft->signal.rate);
}
}
}
@@ -561,15 +561,15 @@
if (ft->handler.flags & SOX_FILE_CHANS) {
if (ft->signal.channels == 1 && !(ft->handler.flags & SOX_FILE_MONO)) {
ft->signal.channels = (ft->handler.flags & SOX_FILE_STEREO)? 2 : 4;
- sox_warn("%s can't encode mono; setting channels to %u", ft->handler.names[0], ft->signal.channels);
+ lsx_warn("%s can't encode mono; setting channels to %u", ft->handler.names[0], ft->signal.channels);
} else
if (ft->signal.channels == 2 && !(ft->handler.flags & SOX_FILE_STEREO)) {
ft->signal.channels = (ft->handler.flags & SOX_FILE_QUAD)? 4 : 1;
- sox_warn("%s can't encode stereo; setting channels to %u", ft->handler.names[0], ft->signal.channels);
+ lsx_warn("%s can't encode stereo; setting channels to %u", ft->handler.names[0], ft->signal.channels);
} else
if (ft->signal.channels == 4 && !(ft->handler.flags & SOX_FILE_QUAD)) {
ft->signal.channels = (ft->handler.flags & SOX_FILE_STEREO)? 2 : 1;
- sox_warn("%s can't encode quad; setting channels to %u", ft->handler.names[0], ft->signal.channels);
+ lsx_warn("%s can't encode quad; setting channels to %u", ft->handler.names[0], ft->signal.channels);
}
} else ft->signal.channels = max(ft->signal.channels, 1);
@@ -584,7 +584,7 @@
while (enc_arg(unsigned));
}
if (e != ft->encoding.encoding) {
- sox_warn("%s can't encode %s", ft->handler.names[0], sox_encodings_info[ft->encoding.encoding].desc);
+ lsx_warn("%s can't encode %s", ft->handler.names[0], sox_encodings_info[ft->encoding.encoding].desc);
ft->encoding.encoding = 0;
}
else {
@@ -612,7 +612,7 @@
if (given_size) {
if (found)
ft->encoding.bits_per_sample = given_size;
- else sox_warn("%s can't encode %s to %u-bit", ft->handler.names[0], sox_encodings_info[ft->encoding.encoding].desc, given_size);
+ else lsx_warn("%s can't encode %s to %u-bit", ft->handler.names[0], sox_encodings_info[ft->encoding.encoding].desc, given_size);
}
}
}
@@ -624,7 +624,7 @@
while (s != ft->encoding.bits_per_sample && (e = enc_arg(sox_encoding_t)))
while ((s = enc_arg(unsigned)) && s != ft->encoding.bits_per_sample);
if (s != ft->encoding.bits_per_sample) {
- sox_warn("%s can't encode to %u-bit", ft->handler.names[0], ft->encoding.bits_per_sample);
+ lsx_warn("%s can't encode to %u-bit", ft->handler.names[0], ft->encoding.bits_per_sample);
ft->encoding.bits_per_sample = 0;
}
else ft->encoding.encoding = e;
@@ -686,30 +686,30 @@
sox_format_handler_t const * handler;
if (!path || !signal) {
- sox_fail("must specify file name and signal parameters to write file");
+ lsx_fail("must specify file name and signal parameters to write file");
goto error;
}
if (filetype) {
if (!(handler = sox_find_format(filetype, sox_false))) {
- sox_fail("no handler for given file type `%s'", filetype);
+ lsx_fail("no handler for given file type `%s'", filetype);
goto error;
}
ft->handler = *handler;
}
else {
- if (!(filetype = sox_find_file_extension(path))) {
- sox_fail("can't determine type of `%s'", path);
+ if (!(filetype = lsx_find_file_extension(path))) {
+ lsx_fail("can't determine type of `%s'", path);
goto error;
}
if (!(handler = sox_find_format(filetype, sox_true))) {
- sox_fail("no handler for file extension `%s'", filetype);
+ lsx_fail("no handler for file extension `%s'", filetype);
goto error;
}
ft->handler = *handler;
}
if (!ft->handler.startwrite && !ft->handler.write) {
- sox_fail("file type `%s' isn't writeable", filetype);
+ lsx_fail("file type `%s' isn't writeable", filetype);
goto error;
}
@@ -716,7 +716,7 @@
if (!(ft->handler.flags & SOX_FILE_NOSTDIO)) {
if (!strcmp(path, "-")) { /* Use stdout if the filename is "-" */
if (sox_globals.stdout_in_use_by) {
- sox_fail("`-' (stdout) already in use by `%s'", sox_globals.stdout_in_use_by);
+ lsx_fail("`-' (stdout) already in use by `%s'", sox_globals.stdout_in_use_by);
goto error;
}
sox_globals.stdout_in_use_by = "audio output";
@@ -727,11 +727,11 @@
struct stat st;
if (!stat(path, &st) && (st.st_mode & S_IFMT) == S_IFREG &&
(overwrite_permitted && !overwrite_permitted(path))) {
- sox_fail("permission to overwrite '%s' denied", path);
+ lsx_fail("permission to overwrite '%s' denied", path);
goto error;
}
if ((ft->fp = fopen(path, "wb")) == NULL) {
- sox_fail("can't open output file `%s': %s", path, strerror(errno));
+ lsx_fail("can't open output file `%s': %s", path, strerror(errno));
goto error;
}
}
@@ -739,7 +739,7 @@
/* stdout tends to be line-buffered. Override this */
/* to be Full Buffering. */
if (setvbuf (ft->fp, NULL, _IOFBF, sizeof(char) * sox_globals.bufsiz)) {
- sox_fail("Can't set write buffer");
+ lsx_fail("Can't set write buffer");
goto error;
}
ft->seekable = is_seekable(ft);
@@ -770,18 +770,18 @@
ft->signal.channels / signal->channels + .5;
if ((ft->handler.flags & SOX_FILE_REWIND) && !ft->signal.length && !ft->seekable)
- sox_warn("can't seek in output file `%s'; length in file header will be unspecified", ft->filename);
+ lsx_warn("can't seek in output file `%s'; length in file header will be unspecified", ft->filename);
ft->priv = lsx_calloc(1, ft->handler.priv_size);
/* Read and write starters can change their formats. */
if (ft->handler.startwrite && (ft->handler.startwrite)(ft) != SOX_SUCCESS){
- sox_fail("can't open output file `%s': %s", ft->filename, ft->sox_errstr);
+ lsx_fail("can't open output file `%s': %s", ft->filename, ft->sox_errstr);
goto error;
}
if (sox_checkformat(ft) == SOX_SUCCESS)
return ft;
- sox_fail("bad format for output file `%s': %s", ft->filename, ft->sox_errstr);
+ lsx_fail("bad format for output file `%s': %s", ft->filename, ft->sox_errstr);
error:
if (ft->fp && ft->fp != stdout)
@@ -826,7 +826,7 @@
if (ft->fp && ft->fp != stdin && ft->fp != stdout &&
xfclose(ft->fp, ft->is_process) && ft->is_process) {
- sox_fail("error reading file URL `%s'", ft->filename);
+ lsx_fail("error reading file URL `%s'", ft->filename);
result = SOX_EOF;
}
free(ft->filename);
@@ -881,7 +881,7 @@
*slash_pos = '\0';
if (file == NULL) {
- sox_fail("Can't open playlist file `%s': %s", listname, strerror(errno));
+ lsx_fail("Can't open playlist file `%s': %s", listname, strerror(errno));
result = SOX_EOF;
}
else {
@@ -933,11 +933,11 @@
} while (c != EOF);
if (ferror(file)) {
- sox_fail("error reading playlist file `%s': %s", listname, strerror(errno));
+ lsx_fail("error reading playlist file `%s': %s", listname, strerror(errno));
result = SOX_EOF;
}
if (xfclose(file, is_process) && is_process) {
- sox_fail("error reading playlist file URL `%s'", listname);
+ lsx_fail("error reading playlist file URL `%s'", listname);
result = SOX_EOF;
}
}
@@ -985,7 +985,7 @@
int ret;
if ((ret = lt_dlinit()) != 0) {
- sox_fail("lt_dlinit failed with %d error(s): %s", ret, lt_dlerror());
+ lsx_fail("lt_dlinit failed with %d error(s): %s", ret, lt_dlerror());
return SOX_EOF;
}
plugins_initted = sox_true;
@@ -998,7 +998,7 @@
{
int ret;
if (plugins_initted && (ret = lt_dlexit()) != 0)
- sox_fail("lt_dlexit failed with %d error(s): %s", ret, lt_dlerror());
+ lsx_fail("lt_dlexit failed with %d error(s): %s", ret, lt_dlerror());
}
#else /* Static format handlers */
--- a/src/formats_i.c
+++ b/src/formats_i.c
@@ -55,19 +55,19 @@
ft->data_start = lsx_tell(ft);
if (channels && ft->signal.channels && ft->signal.channels != channels)
- sox_warn("`%s': overriding number of channels", ft->filename);
+ lsx_warn("`%s': overriding number of channels", ft->filename);
else ft->signal.channels = channels;
if (rate && ft->signal.rate && ft->signal.rate != rate)
- sox_warn("`%s': overriding sample rate", ft->filename);
+ lsx_warn("`%s': overriding sample rate", ft->filename);
else ft->signal.rate = rate;
if (encoding && ft->encoding.encoding && ft->encoding.encoding != encoding)
- sox_warn("`%s': overriding encoding type", ft->filename);
+ lsx_warn("`%s': overriding encoding type", ft->filename);
else ft->encoding.encoding = encoding;
if (bits_per_sample && ft->encoding.bits_per_sample && ft->encoding.bits_per_sample != bits_per_sample)
- sox_warn("`%s': overriding encoding size", ft->filename);
+ lsx_warn("`%s': overriding encoding size", ft->filename);
ft->encoding.bits_per_sample = bits_per_sample;
if (ft->encoding.bits_per_sample && lsx_filelength(ft)) {
@@ -75,7 +75,7 @@
if (!ft->signal.length)
ft->signal.length = calculated_length;
else if (length != calculated_length)
- sox_warn("`%s': file header gives the total number of samples as %u but file length indicates the number is in fact %u", ft->filename, (unsigned)length, (unsigned)calculated_length); /* FIXME: casts */
+ lsx_warn("`%s': file header gives the total number of samples as %u but file length indicates the number is in fact %u", ft->filename, (unsigned)length, (unsigned)calculated_length); /* FIXME: casts */
}
if (sox_precision(ft->encoding.encoding, ft->encoding.bits_per_sample))
--- a/src/htk.c
+++ b/src/htk.c
@@ -51,7 +51,7 @@
double period_100ns = 1e7 / ft->signal.rate;
if (!ft->olength && floor(period_100ns) != period_100ns)
- sox_warn("rounding sample period %f (x 100ns) to nearest integer", period_100ns);
+ lsx_warn("rounding sample period %f (x 100ns) to nearest integer", period_100ns);
return lsx_writedw(ft, (unsigned)(ft->olength? ft->olength:ft->signal.length))
|| lsx_writedw(ft, (unsigned)(period_100ns + .5))
|| lsx_writew(ft, ft->encoding.bits_per_sample >> 3)
--- a/src/ima_rw.c
+++ b/src/ima_rw.c
@@ -81,7 +81,7 @@
val = (short)(ip[0] + (ip[1]<<8)); /* need cast for sign-extend */
state = ip[2];
if (state > ISSTMAX) {
- sox_warn("IMA_ADPCM block ch%d initial-state (%d) out of range", ch, state);
+ lsx_warn("IMA_ADPCM block ch%d initial-state (%d) out of range", ch, state);
state = 0;
}
/* specs say to ignore ip[3] , but write it as 0 */
--- a/src/input.c
+++ b/src/input.c
@@ -43,7 +43,7 @@
* 0 samples is returned does it indicate that end-of-file has been reached
* or an error has occurred */
if (!*osamp && p->file->sox_errno)
- sox_fail("%s: %s", p->file->filename, p->file->sox_errstr);
+ lsx_fail("%s: %s", p->file->filename, p->file->sox_errstr);
return *osamp? SOX_SUCCESS : SOX_EOF;
}
--- a/src/ladspa.c
+++ b/src/ladspa.c
@@ -71,7 +71,7 @@
d = p->LowerBound * 0.25 + p->UpperBound * 0.75;
} else { /* shouldn't happen */
/* FIXME: Deal with this at a higher level */
- sox_fail("non-existent default value; using 0.1");
+ lsx_fail("non-existent default value; using 0.1");
d = 0.1; /* Should at least avoid divide by 0 */
}
@@ -104,19 +104,19 @@
path = LADSPA_PATH;
lt_dlsetsearchpath(path);
if ((l_st->lth = lt_dlopenext(l_st->name)) == NULL) {
- sox_fail("could not open LADSPA plugin %s", l_st->name);
+ lsx_fail("could not open LADSPA plugin %s", l_st->name);
return SOX_EOF;
}
/* Get descriptor function */
if ((ltptr.ptr = lt_dlsym(l_st->lth, "ladspa_descriptor")) == NULL) {
- sox_fail("could not find ladspa_descriptor");
+ lsx_fail("could not find ladspa_descriptor");
return SOX_EOF;
}
/* If no plugins in this module, complain */
if (ltptr.fn(0UL) == NULL) {
- sox_fail("no plugins found");
+ lsx_fail("no plugins found");
return SOX_EOF;
}
@@ -130,7 +130,7 @@
while (l_st->desc && strcmp(l_st->desc->Label, argv[0]) != 0)
l_st->desc = ltptr.fn(++index);
if (l_st->desc == NULL) {
- sox_fail("no plugin called `%s' found", argv[0]);
+ lsx_fail("no plugin called `%s' found", argv[0]);
return SOX_EOF;
} else
n--; argv++;
@@ -144,10 +144,10 @@
/* Check port is well specified. All control ports should be
inputs, but don't bother checking, as we never rely on this. */
if (LADSPA_IS_PORT_INPUT(port) && LADSPA_IS_PORT_OUTPUT(port)) {
- sox_fail("port %lu is both input and output", i);
+ lsx_fail("port %lu is both input and output", i);
return SOX_EOF;
} else if (LADSPA_IS_PORT_CONTROL(port) && LADSPA_IS_PORT_AUDIO(port)) {
- sox_fail("port %lu is both audio and control", i);
+ lsx_fail("port %lu is both audio and control", i);
return SOX_EOF;
}
@@ -154,13 +154,13 @@
if (LADSPA_IS_PORT_AUDIO(port)) {
if (LADSPA_IS_PORT_INPUT(port)) {
if (l_st->input_port != ULONG_MAX) {
- sox_fail("can't use a plugin with more than one audio input port");
+ lsx_fail("can't use a plugin with more than one audio input port");
return SOX_EOF;
}
l_st->input_port = i;
} else if (LADSPA_IS_PORT_OUTPUT(port)) {
if (l_st->output_port != ULONG_MAX) {
- sox_fail("can't use a plugin with more than one audio output port");
+ lsx_fail("can't use a plugin with more than one audio output port");
return SOX_EOF;
}
l_st->output_port = i;
@@ -168,7 +168,7 @@
} else { /* Control port */
if (n == 0) {
if (!LADSPA_IS_HINT_HAS_DEFAULT(l_st->desc->PortRangeHints[i].HintDescriptor)) {
- sox_fail("not enough arguments for control ports");
+ lsx_fail("not enough arguments for control ports");
return SOX_EOF;
}
l_st->control[i] = ladspa_default(&(l_st->desc->PortRangeHints[i]));
@@ -199,7 +199,7 @@
lsx_debug("rate for plugin is %g", effp->in_signal.rate);
l_st->handle = l_st->desc->instantiate(l_st->desc, (unsigned long)effp->in_signal.rate);
if (l_st->handle == NULL) {
- sox_fail("could not instantiate plugin");
+ lsx_fail("could not instantiate plugin");
return SOX_EOF;
}
--- a/src/libsox.c
+++ b/src/libsox.c
@@ -59,9 +59,9 @@
vfprintf(file, fmt, ap);
}
-#undef sox_fail
-#undef sox_warn
-#undef sox_report
+#undef lsx_fail
+#undef lsx_warn
+#undef lsx_report
#undef lsx_debug
#undef lsx_debug_more
#undef lsx_debug_most
@@ -75,9 +75,9 @@
va_end(ap); \
}
-SOX_MESSAGE_FUNCTION(sox_fail , 1)
-SOX_MESSAGE_FUNCTION(sox_warn , 2)
-SOX_MESSAGE_FUNCTION(sox_report, 3)
+SOX_MESSAGE_FUNCTION(lsx_fail , 1)
+SOX_MESSAGE_FUNCTION(lsx_warn , 2)
+SOX_MESSAGE_FUNCTION(lsx_report, 3)
SOX_MESSAGE_FUNCTION(lsx_debug , 4)
SOX_MESSAGE_FUNCTION(lsx_debug_more , 5)
SOX_MESSAGE_FUNCTION(lsx_debug_most , 6)
--- a/src/mcompand.c
+++ b/src/mcompand.c
@@ -234,7 +234,7 @@
if (commas % 2 == 0) /* There must be an even number of
attack/decay parameters */
{
- sox_fail("compander: Odd number of attack & decay rate parameters");
+ lsx_fail("compander: Odd number of attack & decay rate parameters");
return (SOX_EOF);
}
@@ -292,7 +292,7 @@
if (*subargc < 2 || *subargc > 5)
{
- sox_fail("Wrong number of parameters for the compander effect within mcompand; usage:\n"
+ lsx_fail("Wrong number of parameters for the compander effect within mcompand; usage:\n"
"\tattack1,decay1{,attack2,decay2} [soft-knee-dB:]in-dB1[,out-dB1]{,in-dB2,out-dB2} [gain [initial-volume-dB [delay]]]\n"
"\twhere {} means optional and repeatable and [] means optional.\n"
"\tdB values are floating point or -inf'; times are in seconds.");
@@ -313,7 +313,7 @@
/* how many bands? */
if (! (n&1)) {
- sox_fail("mcompand accepts only an odd number of arguments:\n"
+ lsx_fail("mcompand accepts only an odd number of arguments:\n"
" mcompand quoted_compand_args [xover_freq quoted_compand_args [...]");
return SOX_EOF;
}
@@ -332,11 +332,11 @@
else {
c->bands[i].topfreq = lsx_parse_frequency(argv[(i<<1)+1],&cp);
if (*cp) {
- sox_fail("bad frequency in args to mcompand");
+ lsx_fail("bad frequency in args to mcompand");
return SOX_EOF;
}
if ((i>0) && (c->bands[i].topfreq < c->bands[i-1].topfreq)) {
- sox_fail("mcompand crossover frequencies must be in ascending order.");
+ lsx_fail("mcompand crossover frequencies must be in ascending order.");
return SOX_EOF;
}
}
--- a/src/mixer.c
+++ b/src/mixer.c
@@ -73,7 +73,7 @@
if (*s == ',') {
++commas;
if (commas >= 16) {
- sox_fail("mixer can only take up to 16 pan values");
+ lsx_fail("mixer can only take up to 16 pan values");
return (SOX_EOF);
}
pans[commas] = atof(s+1);
@@ -169,7 +169,7 @@
ichan = effp->in_signal.channels;
ochan = effp->out_signal.channels;
if (ochan == -1) {
- sox_fail("Output must have known number of channels");
+ lsx_fail("Output must have known number of channels");
return(SOX_EOF);
}
@@ -176,7 +176,7 @@
if ((ichan != 1 && ichan != 2 && ichan != 4 &&
mixer->mix != MIX_CENTER && ochan != 1)
|| (ochan != 1 && ochan != 2 && ochan != 4)) {
- sox_fail("Can't mix %d -> %d channels", ichan, ochan);
+ lsx_fail("Can't mix %d -> %d channels", ichan, ochan);
return (SOX_EOF);
}
@@ -203,7 +203,7 @@
}
else
{
- sox_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
+ lsx_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
return SOX_EOF;
}
break;
@@ -224,7 +224,7 @@
}
else
{
- sox_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
+ lsx_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
return SOX_EOF;
}
break;
@@ -245,7 +245,7 @@
}
else
{
- sox_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
+ lsx_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
return SOX_EOF;
}
break;
@@ -266,7 +266,7 @@
}
else
{
- sox_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
+ lsx_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
return SOX_EOF;
}
break;
@@ -287,7 +287,7 @@
}
else
{
- sox_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
+ lsx_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
return SOX_EOF;
}
break;
@@ -308,7 +308,7 @@
}
else
{
- sox_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
+ lsx_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
return SOX_EOF;
}
break;
@@ -324,7 +324,7 @@
}
else
{
- sox_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
+ lsx_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
return SOX_EOF;
}
break;
@@ -340,7 +340,7 @@
}
else
{
- sox_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
+ lsx_fail("Can't mix -%c %d -> %d channels", mixer->mix, ichan, ochan);
return SOX_EOF;
}
break;
@@ -348,7 +348,7 @@
case MIX_SPECIFIED:
break;
default:
- sox_fail("Unknown mix option");
+ lsx_fail("Unknown mix option");
return SOX_EOF;
}
@@ -398,7 +398,7 @@
mixer->sources[3][1] = 0.5;
}
else {
- sox_fail("You must specify at least one mix level when using mixer with an unusual number of channels.");
+ lsx_fail("You must specify at least one mix level when using mixer with an unusual number of channels.");
return(SOX_EOF);
}
}
@@ -426,7 +426,7 @@
}
else
{
- sox_fail("Invalid options while not mixing");
+ lsx_fail("Invalid options while not mixing");
return SOX_EOF;
}
}
@@ -453,12 +453,12 @@
}
else
{
- sox_fail("Invalid options for this channel combination");
+ lsx_fail("Invalid options for this channel combination");
return SOX_EOF;
}
}
else if (mixer->num_pans == 3) {
- sox_fail("Invalid options while not mixing");
+ lsx_fail("Invalid options while not mixing");
return SOX_EOF;
}
else if (mixer->num_pans == 4) {
@@ -479,7 +479,7 @@
}
else
{
- sox_fail("Invalid options for this channel combination");
+ lsx_fail("Invalid options for this channel combination");
return SOX_EOF;
}
}
--- a/src/mp3-duration.h
+++ b/src/mp3-duration.h
@@ -128,7 +128,7 @@
if (mad_stream.error == MAD_ERROR_BUFLEN)
break; /* Normal behaviour; get some more data from the file */
if (!MAD_RECOVERABLE(mad_stream.error)) {
- sox_warn("unrecoverable MAD error");
+ lsx_warn("unrecoverable MAD error");
break;
}
if (mad_stream.error == MAD_ERROR_LOSTSYNC) {
@@ -141,9 +141,9 @@
}
mad_stream_skip(&mad_stream, min(tagsize, available));
}
- else sox_warn("MAD lost sync");
+ else lsx_warn("MAD lost sync");
}
- else sox_warn("recoverable MAD error");
+ else lsx_warn("recoverable MAD error");
continue; /* Not an audio frame */
}
@@ -157,7 +157,7 @@
mad_frame.header = mad_header;
if (mad_frame_decode(&mad_frame, &mad_stream) == -1)
if (!MAD_RECOVERABLE(mad_stream.error)) {
- sox_warn("unrecoverable MAD error");
+ lsx_warn("unrecoverable MAD error");
break;
}
if ((frames = xing_frames(mad_stream.anc_ptr, mad_stream.anc_bitlen))) {
--- a/src/mp3.c
+++ b/src/mp3.c
@@ -307,7 +307,7 @@
continue;
else
{
- sox_report("unrecoverable frame level error (%s).",
+ lsx_report("unrecoverable frame level error (%s).",
mad_stream_errorstr(&p->Stream));
return done;
}
@@ -356,7 +356,7 @@
if (ft->encoding.encoding != SOX_ENCODING_MP3) {
if(ft->encoding.encoding != SOX_ENCODING_UNKNOWN)
- sox_report("Encoding forced to MP3");
+ lsx_report("Encoding forced to MP3");
ft->encoding.encoding = SOX_ENCODING_MP3;
}
@@ -386,7 +386,7 @@
here. E.g. by using the -C value as an index into a table of params or
as a compressed bit-rate. */
if (ft->encoding.compression != HUGE_VAL)
- sox_warn("-C option not supported for mp3; using default compression rate");
+ lsx_warn("-C option not supported for mp3; using default compression rate");
if (lame_init_params(p->gfp) < 0){
lsx_fail_errno(ft,SOX_EOF,"LAME initialization failed");
return(SOX_EOF);
--- a/src/noiseprof.c
+++ b/src/noiseprof.c
@@ -68,7 +68,7 @@
* since we already use stderr for diagnostics. */
if (!data->output_filename || !strcmp(data->output_filename, "-")) {
if (effp->global_info->global_info->stdout_in_use_by) {
- sox_fail("stdout already in use by '%s'", effp->global_info->global_info->stdout_in_use_by);
+ lsx_fail("stdout already in use by '%s'", effp->global_info->global_info->stdout_in_use_by);
return SOX_EOF;
}
effp->global_info->global_info->stdout_in_use_by = effp->handler.name;
@@ -75,7 +75,7 @@
data->output_file = stdout;
}
else if ((data->output_file = fopen(data->output_filename, "w")) == NULL) {
- sox_fail("Couldn't open profile file %s: %s", data->output_filename, strerror(errno));
+ lsx_fail("Couldn't open profile file %s: %s", data->output_filename, strerror(errno));
return SOX_EOF;
}
--- a/src/noisered.c
+++ b/src/noisered.c
@@ -98,7 +98,7 @@
/* Here we actually open the input file. */
if (!data->profile_filename || !strcmp(data->profile_filename, "-")) {
if (effp->global_info->global_info->stdin_in_use_by) {
- sox_fail("stdin already in use by '%s'", effp->global_info->global_info->stdin_in_use_by);
+ lsx_fail("stdin already in use by '%s'", effp->global_info->global_info->stdin_in_use_by);
return SOX_EOF;
}
effp->global_info->global_info->stdin_in_use_by = effp->handler.name;
@@ -105,7 +105,7 @@
ifp = stdin;
}
else if ((ifp = fopen(data->profile_filename, "r")) == NULL) {
- sox_fail("Couldn't open profile file %s: %s",
+ lsx_fail("Couldn't open profile file %s: %s",
data->profile_filename, strerror(errno));
return SOX_EOF;
}
@@ -118,7 +118,7 @@
break;
i1 = i1_ul;
if (i1 != fchannels) {
- sox_fail("noisered: Got channel %lu, expected channel %lu.",
+ lsx_fail("noisered: Got channel %lu, expected channel %lu.",
(unsigned long)i1, (unsigned long)fchannels);
return SOX_EOF;
}
@@ -126,7 +126,7 @@
data->chandata[fchannels].noisegate[0] = f1;
for (i = 1; i < FREQCOUNT; i ++) {
if (1 != fscanf(ifp, ", %f", &f1)) {
- sox_fail("noisered: Not enough datums for channel %lu "
+ lsx_fail("noisered: Not enough datums for channel %lu "
"(expected %d, got %lu)", (unsigned long)fchannels, FREQCOUNT, (unsigned long)i);
return SOX_EOF;
}
@@ -135,7 +135,7 @@
fchannels ++;
}
if (fchannels != channels) {
- sox_fail("noisered: channel mismatch: %lu in input, %lu in profile.",
+ lsx_fail("noisered: channel mismatch: %lu in input, %lu in profile.",
(unsigned long)channels, (unsigned long)fchannels);
return SOX_EOF;
}
--- a/src/normalise.c
+++ b/src/normalise.c
@@ -46,7 +46,7 @@
p->norm0 = p->max = p->min = 0;
p->tmp_file = tmpfile();
if (p->tmp_file == NULL) {
- sox_fail("can't create temporary file: %s", strerror(errno));
+ lsx_fail("can't create temporary file: %s", strerror(errno));
return SOX_EOF;
}
return SOX_SUCCESS;
@@ -59,7 +59,7 @@
size_t len;
if (fwrite(ibuf, sizeof(*ibuf), *isamp, p->tmp_file) != *isamp) {
- sox_fail("error writing temporary file: %s", strerror(errno));
+ lsx_fail("error writing temporary file: %s", strerror(errno));
return SOX_EOF;
}
if (p->balance) for (len = *osamp; len; --len, ++ibuf) {
@@ -100,7 +100,7 @@
}
len = fread(obuf, sizeof(*obuf), *osamp, p->tmp_file);
if (len != *osamp && !feof(p->tmp_file)) {
- sox_fail("error reading temporary file: %s", strerror(errno));
+ lsx_fail("error reading temporary file: %s", strerror(errno));
result = SOX_EOF;
}
if (p->balance) for (*osamp = len; len; --len, ++obuf)
--- a/src/nulfile.c
+++ b/src/nulfile.c
@@ -23,7 +23,7 @@
{
if (!ft->signal.rate) {
ft->signal.rate = SOX_DEFAULT_RATE;
- sox_report("sample rate not specified; using %g", ft->signal.rate);
+ lsx_report("sample rate not specified; using %g", ft->signal.rate);
}
ft->signal.precision = ft->encoding.bits_per_sample?
ft->encoding.bits_per_sample: SOX_SAMPLE_PRECISION;
--- a/src/oss.c
+++ b/src/oss.c
@@ -54,8 +54,8 @@
if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
ft->encoding.encoding = SOX_ENCODING_UNSIGNED;
if (ft->encoding.encoding != SOX_ENCODING_UNSIGNED) {
- sox_report("OSS driver only supports unsigned with bytes");
- sox_report("Forcing to unsigned");
+ lsx_report("OSS driver only supports unsigned with bytes");
+ lsx_report("Forcing to unsigned");
ft->encoding.encoding = SOX_ENCODING_UNSIGNED;
}
}
@@ -69,8 +69,8 @@
if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
ft->encoding.encoding = SOX_ENCODING_SIGN2;
if (ft->encoding.encoding != SOX_ENCODING_SIGN2) {
- sox_report("OSS driver only supports signed with words");
- sox_report("Forcing to signed linear");
+ lsx_report("OSS driver only supports signed with words");
+ lsx_report("Forcing to signed linear");
ft->encoding.encoding = SOX_ENCODING_SIGN2;
}
}
@@ -83,8 +83,8 @@
samplesize = 16;
ft->encoding.bits_per_sample = 16;
ft->encoding.encoding = SOX_ENCODING_SIGN2;
- sox_report("OSS driver only supports bytes and words");
- sox_report("Forcing to signed linear word");
+ lsx_report("OSS driver only supports bytes and words");
+ lsx_report("Forcing to signed linear word");
}
if (ft->signal.channels > 2) ft->signal.channels = 2;
@@ -107,8 +107,8 @@
/* Must not like 16-bits, try 8-bits */
ft->encoding.bits_per_sample = 8;
ft->encoding.encoding = SOX_ENCODING_UNSIGNED;
- sox_report("OSS driver doesn't like signed words");
- sox_report("Forcing to unsigned bytes");
+ lsx_report("OSS driver doesn't like signed words");
+ lsx_report("Forcing to unsigned bytes");
tmp = sampletype = AFMT_U8;
samplesize = 8;
}
@@ -117,8 +117,8 @@
{
ft->encoding.bits_per_sample = 16;
ft->encoding.encoding = SOX_ENCODING_SIGN2;
- sox_report("OSS driver doesn't like unsigned bytes");
- sox_report("Forcing to signed words");
+ lsx_report("OSS driver doesn't like unsigned bytes");
+ lsx_report("Forcing to signed words");
sampletype = (MACHINE_IS_BIGENDIAN) ? AFMT_S16_BE : AFMT_S16_LE;
samplesize = 16;
}
@@ -151,7 +151,7 @@
tmp = dsp_stereo;
if (ioctl(fileno(ft->fp), SNDCTL_DSP_STEREO, &tmp) < 0)
{
- sox_warn("Couldn't set to %s", dsp_stereo? "stereo":"mono");
+ lsx_warn("Couldn't set to %s", dsp_stereo? "stereo":"mono");
dsp_stereo = 0;
}
@@ -158,7 +158,7 @@
if (tmp != dsp_stereo)
{
if (client_signal.channels != 0)
- sox_warn("Sound card appears to support only %d channels. Overriding format", tmp+1);
+ lsx_warn("Sound card appears to support only %d channels. Overriding format", tmp+1);
ft->signal.channels = tmp + 1;
}
@@ -176,7 +176,7 @@
if ((int)ft->signal.rate - tmp > (tmp * .01) ||
tmp - (int)ft->signal.rate > (tmp * .01)) {
if (client_signal.rate != 0)
- sox_warn("Unable to set audio speed to %g (set to %d)",
+ lsx_warn("Unable to set audio speed to %g (set to %d)",
ft->signal.rate, tmp);
ft->signal.rate = tmp;
}
--- a/src/output.c
+++ b/src/output.c
@@ -38,7 +38,7 @@
* different to *isamp, then something has gone wrong--most often, it's
* out of disc space */
if (len != *isamp) {
- sox_fail("%s: %s", p->file->filename, p->file->sox_errstr);
+ lsx_fail("%s: %s", p->file->filename, p->file->sox_errstr);
return SOX_EOF;
}
--- a/src/pad.c
+++ b/src/pad.c
@@ -117,7 +117,7 @@
{
priv_t * p = (priv_t *)effp->priv;
if (p->pads_pos != p->npads)
- sox_warn("Input audio too short; pads not applied: %u", p->npads-p->pads_pos);
+ lsx_warn("Input audio too short; pads not applied: %u", p->npads-p->pads_pos);
return SOX_SUCCESS;
}
--- a/src/pan.c
+++ b/src/pan.c
@@ -56,13 +56,13 @@
static int sox_pan_start(sox_effect_t * effp)
{
if (effp->out_signal.channels==1)
- sox_warn("PAN onto a mono channel...");
+ lsx_warn("PAN onto a mono channel...");
return SOX_SUCCESS;
}
#define UNEXPECTED_CHANNELS \
- sox_fail("unexpected number of channels (in=%d, out=%d)", ich, och); \
+ lsx_fail("unexpected number of channels (in=%d, out=%d)", ich, och); \
free(ibuf_copy); \
return SOX_EOF
--- a/src/phaser.c
+++ b/src/phaser.c
@@ -114,39 +114,39 @@
if ( phaser->delay < 0.0 )
{
- sox_fail("phaser: delay must be positive!");
+ lsx_fail("phaser: delay must be positive!");
return (SOX_EOF);
}
if ( phaser->delay > 5.0 )
{
- sox_fail("phaser: delay must be less than 5.0 msec!");
+ lsx_fail("phaser: delay must be less than 5.0 msec!");
return (SOX_EOF);
}
if ( phaser->speed < 0.1 )
{
- sox_fail("phaser: speed must be more than 0.1 Hz!");
+ lsx_fail("phaser: speed must be more than 0.1 Hz!");
return (SOX_EOF);
}
if ( phaser->speed > 2.0 )
{
- sox_fail("phaser: speed must be less than 2.0 Hz!");
+ lsx_fail("phaser: speed must be less than 2.0 Hz!");
return (SOX_EOF);
}
if ( phaser->decay < 0.0 )
{
- sox_fail("phaser: decay must be positive!" );
+ lsx_fail("phaser: decay must be positive!" );
return (SOX_EOF);
}
if ( phaser->decay >= 1.0 )
{
- sox_fail("phaser: decay must be less that 1.0!" );
+ lsx_fail("phaser: decay must be less that 1.0!" );
return (SOX_EOF);
}
/* Be nice and check the hint with warning, if... */
if ( phaser->in_gain > ( 1.0 - phaser->decay * phaser->decay ) )
- sox_warn("phaser: warning >>> gain-in can cause saturation or clipping of output <<<");
+ lsx_warn("phaser: warning >>> gain-in can cause saturation or clipping of output <<<");
if ( phaser->in_gain / ( 1.0 - phaser->decay ) > 1.0 / phaser->out_gain )
- sox_warn("phaser: warning >>> gain-out can cause saturation or clipping of output <<<");
+ lsx_warn("phaser: warning >>> gain-out can cause saturation or clipping of output <<<");
phaser->length = effp->in_signal.rate / phaser->speed;
phaser->phaserbuf = lsx_malloc(sizeof (double) * phaser->maxsamples);
--- a/src/polyphas.c
+++ b/src/polyphas.c
@@ -95,7 +95,7 @@
continue;
}
- sox_fail("Polyphase: unknown argument (%s %s)!", argv[0], argv[1]);
+ lsx_fail("Polyphase: unknown argument (%s %s)!", argv[0], argv[1]);
return SOX_EOF;
}
@@ -134,7 +134,7 @@
while (n > 1) {
while ((pr = *p) && (n % pr)) p++;
if (!pr) {
- sox_fail("Number %d too large of a prime.",n);
+ lsx_fail("Number %d too large of a prime.",n);
pr = n;
}
*q++ = pr;
@@ -261,7 +261,7 @@
int N1;
if(buffer == NULL || length <= 0)
- sox_fail("Illegal buffer %p or length %d to nuttall.", (void *)buffer, length);
+ lsx_fail("Illegal buffer %p or length %d to nuttall.", (void *)buffer, length);
/* Initial variable setups. */
N = length;
@@ -284,7 +284,7 @@
int N1;
if(buffer == NULL || length <= 0)
- sox_fail("Illegal buffer %p or length %d to hamming.",(void *)buffer,length);
+ lsx_fail("Illegal buffer %p or length %d to hamming.",(void *)buffer,length);
N1 = length/2;
for(j=0;j<length;j++)
@@ -310,7 +310,7 @@
double sum;
if(buffer == NULL || length < 0 || cutoff < 0 || cutoff > M_PI)
- sox_fail("Illegal buffer %p, length %d, or cutoff %f.",(void *)buffer,length,cutoff);
+ lsx_fail("Illegal buffer %p, length %d, or cutoff %f.",(void *)buffer,length,cutoff);
/* Use the user-option of window type */
if (rate->win_type == 0)
--- a/src/prc.c
+++ b/src/prc.c
@@ -172,7 +172,7 @@
lsx_readb(ft, &volume);
lsx_debug("Volume: %d", (unsigned)volume);
if (volume < 1 || volume > 5)
- sox_warn("Volume %d outside range 1..5", volume);
+ lsx_warn("Volume %d outside range 1..5", volume);
lsx_readb(ft, &byte); /* Unused and seems always zero */
@@ -183,11 +183,11 @@
lsx_debug("Number of bytes in samples list: %u", listlen);
if (ft->signal.rate != 0 && ft->signal.rate != 8000)
- sox_report("PRC only supports 8 kHz; overriding.");
+ lsx_report("PRC only supports 8 kHz; overriding.");
ft->signal.rate = 8000;
if (ft->signal.channels != 1 && ft->signal.channels != 0)
- sox_report("PRC only supports 1 channel; overriding.");
+ lsx_report("PRC only supports 1 channel; overriding.");
ft->signal.channels = 1;
p->data_start = lsx_tell(ft);
@@ -393,7 +393,7 @@
p->nbytes = lsx_tell(ft) - p->data_start;
if (!ft->seekable) {
- sox_warn("Header will have invalid file length since file is not seekable");
+ lsx_warn("Header will have invalid file length since file is not seekable");
return SOX_SUCCESS;
}
--- a/src/rabbit.c
+++ b/src/rabbit.c
@@ -94,7 +94,7 @@
r->state = src_new(r->converter_type, (int)effp->in_signal.channels, &err);
if (err) {
free(r->data);
- sox_fail("cannot initialise rabbit: %s", src_strerror(err));
+ lsx_fail("cannot initialise rabbit: %s", src_strerror(err));
return SOX_EOF;
}
@@ -139,7 +139,7 @@
*osamp = 0;
while (d->input_frames > 0 || d->end_of_input != 0) {
if (src_process(r->state, r->data) != 0) {
- sox_fail("%s", src_strerror(src_error(r->state)));
+ lsx_fail("%s", src_strerror(src_error(r->state)));
return SOX_EOF;
}
d->input_frames -= d->input_frames_used;
--- a/src/rate.c
+++ b/src/rate.c
@@ -428,7 +428,7 @@
prepare_coefs(coefs, f->num_coefs, phases, interp_order, mult);
lsx_debug("fir_len=%i phases=%i coef_interp=%i mult=%i size=%s",
f->num_coefs, phases, interp_order, mult,
- sox_sigfigs3((num_taps + 1) * (interp_order + 1) * sizeof(sample_t)));
+ lsx_sigfigs3((num_taps + 1) * (interp_order + 1) * sizeof(sample_t)));
free(coefs);
}
last_stage.fn = f1->fn;
@@ -579,17 +579,17 @@
case 's': p->bandwidth = 99; break;
case 'a': p->allow_aliasing = sox_true; break;
default: if ((found_at = strchr(qopts, c))) p->quality = found_at - qopts;
- else {sox_fail("unknown option `-%c'", optopt); return lsx_usage(effp);}
+ else {lsx_fail("unknown option `-%c'", optopt); return lsx_usage(effp);}
}
argc -= optind, argv += optind;
if ((unsigned)p->quality < 2 && (p->bandwidth || p->phase != 25 || p->allow_aliasing)) {
- sox_fail("override options not allowed with this quality level");
+ lsx_fail("override options not allowed with this quality level");
return SOX_EOF;
}
if (p->bandwidth && p->bandwidth < 100 - MAX_TBW3A && p->allow_aliasing) {
- sox_fail("minimum allowed bandwidth with aliasing is %g%%", 100 - MAX_TBW3A);
+ lsx_fail("minimum allowed bandwidth with aliasing is %g%%", 100 - MAX_TBW3A);
return SOX_EOF;
}
--- a/src/raw.c
+++ b/src/raw.c
@@ -27,12 +27,12 @@
sox_encoding_t encoding, unsigned size)
{
if (default_rate && ft->signal.rate == 0) {
- sox_warn("'%s': sample rate not specified; trying 8kHz", ft->filename);
+ lsx_warn("'%s': sample rate not specified; trying 8kHz", ft->filename);
ft->signal.rate = 8000;
}
if (default_channels && ft->signal.channels == 0) {
- sox_warn("'%s': # channels not specified; trying mono", ft->filename);
+ lsx_warn("'%s': # channels not specified; trying mono", ft->filename);
ft->signal.channels = 1;
}
@@ -39,7 +39,7 @@
if (encoding != SOX_ENCODING_UNKNOWN) {
if (ft->mode == 'r' && ft->encoding.encoding != SOX_ENCODING_UNKNOWN &&
ft->encoding.encoding != encoding)
- sox_report("'%s': Format options overriding file-type encoding",
+ lsx_report("'%s': Format options overriding file-type encoding",
ft->filename);
else
ft->encoding.encoding = encoding;
@@ -48,7 +48,7 @@
if (size != 0) {
if (ft->mode == 'r' && ft->encoding.bits_per_sample != 0 &&
ft->encoding.bits_per_sample != size)
- sox_report("'%s': Format options overriding file-type sample-size",
+ lsx_report("'%s': Format options overriding file-type sample-size",
ft->filename);
else
ft->encoding.bits_per_sample = size;
--- a/src/remix.c
+++ b/src/remix.c
@@ -113,7 +113,7 @@
priv_t * p = (priv_t *)effp->priv;
parse(effp, NULL, effp->in_signal.channels);
if (effp->in_signal.channels < p->min_in_channels) {
- sox_fail("too few input channels");
+ lsx_fail("too few input channels");
return SOX_EOF;
}
return SOX_SUCCESS;
--- a/src/repeat.c
+++ b/src/repeat.c
@@ -43,7 +43,7 @@
return SOX_EFF_NULL;
if ((p->tmp_file = tmpfile()) == NULL) {
- sox_fail("can't create temporary file: %s", strerror(errno));
+ lsx_fail("can't create temporary file: %s", strerror(errno));
return SOX_EOF;
}
p->first_drain = 1;
@@ -55,7 +55,7 @@
{
priv_t * p = (priv_t *)effp->priv;
if (fwrite(ibuf, sizeof(*ibuf), *isamp, p->tmp_file) != *isamp) {
- sox_fail("error writing temporary file: %s", strerror(errno));
+ lsx_fail("error writing temporary file: %s", strerror(errno));
return SOX_EOF;
}
(void)obuf, *osamp = 0; /* samples not output until drain */
@@ -77,7 +77,7 @@
p->total = ftello(p->tmp_file);
if ((p->total % sizeof(sox_sample_t)) != 0) {
- sox_fail("corrupted temporary file");
+ lsx_fail("corrupted temporary file");
return (SOX_EOF);
}
@@ -104,7 +104,7 @@
read = fread(buf, sizeof(sox_sample_t), samp, p->tmp_file);
if (read != samp) {
perror(strerror(errno));
- sox_fail("read error on temporary file");
+ lsx_fail("read error on temporary file");
return (SOX_EOF);
}
@@ -129,7 +129,7 @@
read = fread(buf, sizeof(sox_sample_t), samp, p->tmp_file);
if (read != samp) {
perror(strerror(errno));
- sox_fail("repeat2: read error on temporary " "file\n");
+ lsx_fail("repeat2: read error on temporary " "file\n");
return (SOX_EOF);
}
@@ -142,7 +142,7 @@
read = fread(obuf, sizeof(sox_sample_t), *osamp, p->tmp_file);
if (read != *osamp) {
perror(strerror(errno));
- sox_fail("repeat3: read error on temporary file");
+ lsx_fail("repeat3: read error on temporary file");
return (SOX_EOF);
}
p->remaining -= *osamp;
--- a/src/resample.c
+++ b/src/resample.c
@@ -162,7 +162,7 @@
if ((n >= 1) && (sscanf(argv[0], "%lf", &r->rolloff) != 1)) {
return lsx_usage(effp);
} else if ((r->rolloff <= 0.01) || (r->rolloff >= 1.0)) {
- sox_fail("rolloff factor (%f) no good, should be 0.01<x<1.0", r->rolloff);
+ lsx_fail("rolloff factor (%f) no good, should be 0.01<x<1.0", r->rolloff);
return(SOX_EOF);
}
@@ -212,7 +212,7 @@
/* returns error # <=0, or adjusted wing-len > 0 */
i = lsx_makeFilter(r->Imp, r->Nwing, r->rolloff, r->beta, r->Nq, 1);
if (i <= 0) {
- sox_fail("Unable to make filter");
+ lsx_fail("Unable to make filter");
return (SOX_EOF);
}
@@ -244,7 +244,7 @@
}
i = BUFFSIZE - 2 * Xoff;
if (i < r->Factor + 1.0 / r->Factor) { /* Check input buffer size */
- sox_fail("Factor is too small or large for BUFFSIZE");
+ lsx_fail("Factor is too small or large for BUFFSIZE");
return (SOX_EOF);
}
@@ -283,7 +283,7 @@
Nx = Nproc - r->Xread; /* space for right-wing future-data */
if (Nx <= 0)
{
- sox_fail("Can not handle this sample rate change. Nx not positive: %li", Nx);
+ lsx_fail("Can not handle this sample rate change. Nx not positive: %li", Nx);
return (SOX_EOF);
}
if ((unsigned long)Nx > *isamp)
@@ -399,7 +399,7 @@
*osamp -= osamp_res;
lsx_debug("DRAIN osamp %lu", (unsigned long)*osamp);
if (isamp_res)
- sox_warn("drain overran obuf by %li", isamp_res);
+ lsx_warn("drain overran obuf by %li", isamp_res);
/* FIXME: This is very picky. IF obuf is not big enough to
* drain remaining samples, they will be lost.
*/
--- a/src/reverb.c
+++ b/src/reverb.c
@@ -198,7 +198,7 @@
p->ichannels = p->ochannels = 1;
effp->out_signal.rate = effp->in_signal.rate;
if (effp->in_signal.channels > 2 && p->stereo_depth) {
- sox_warn("stereo-depth not applicable with >2 channels");
+ lsx_warn("stereo-depth not applicable with >2 channels");
p->stereo_depth = 0;
}
if (effp->in_signal.channels == 1 && p->stereo_depth)
--- a/src/reverse.c
+++ b/src/reverse.c
@@ -24,7 +24,7 @@
p->pos = 0;
p->tmp_file = tmpfile();
if (p->tmp_file == NULL) {
- sox_fail("can't create temporary file: %s", strerror(errno));
+ lsx_fail("can't create temporary file: %s", strerror(errno));
return SOX_EOF;
}
return SOX_SUCCESS;
@@ -35,7 +35,7 @@
{
priv_t * p = (priv_t *)effp->priv;
if (fwrite(ibuf, sizeof(*ibuf), *isamp, p->tmp_file) != *isamp) {
- sox_fail("error writing temporary file: %s", strerror(errno));
+ lsx_fail("error writing temporary file: %s", strerror(errno));
return SOX_EOF;
}
(void)obuf, *osamp = 0; /* samples not output until drain */
@@ -51,7 +51,7 @@
fflush(p->tmp_file);
p->pos = ftello(p->tmp_file);
if (p->pos % sizeof(sox_sample_t) != 0) {
- sox_fail("temporary file has incorrect size");
+ lsx_fail("temporary file has incorrect size");
return SOX_EOF;
}
p->pos /= sizeof(sox_sample_t);
@@ -59,7 +59,7 @@
p->pos -= *osamp = min((off_t)*osamp, p->pos);
fseeko(p->tmp_file, (off_t)(p->pos * sizeof(sox_sample_t)), SEEK_SET);
if (fread(obuf, sizeof(sox_sample_t), *osamp, p->tmp_file) != *osamp) {
- sox_fail("error reading temporary file: %s", strerror(errno));
+ lsx_fail("error reading temporary file: %s", strerror(errno));
return SOX_EOF;
}
for (i = 0, j = *osamp - 1; i < j; ++i, --j) { /* reverse the samples */
--- a/src/sf.c
+++ b/src/sf.c
@@ -84,7 +84,7 @@
lsx_fail_errno(ft, SOX_EHDR, "sf: can't find IRCAM identifier");
return SOX_EOF;
}
- sox_report("found %s identifier", id[i].desc);
+ lsx_report("found %s identifier", id[i].desc);
ft->encoding.reverse_bytes = id[i].reverse_bytes;
if (lsx_readf(ft, &rate) || lsx_readdw(ft, &channels) || lsx_readdw(ft, &ft_encoding))
--- a/src/silence.c
+++ b/src/silence.c
@@ -100,7 +100,7 @@
return lsx_usage(effp);
if (silence->start_periods < 0)
{
- sox_fail("Periods must not be negative");
+ lsx_fail("Periods must not be negative");
return(SOX_EOF);
}
argv++;
@@ -180,18 +180,18 @@
{
if ((silence->start_unit != '%') && (silence->start_unit != 'd'))
{
- sox_fail("Invalid unit specified");
+ lsx_fail("Invalid unit specified");
return lsx_usage(effp);
}
if ((silence->start_unit == '%') && ((silence->start_threshold < 0.0)
|| (silence->start_threshold > 100.0)))
{
- sox_fail("silence threshold should be between 0.0 and 100.0 %%");
+ lsx_fail("silence threshold should be between 0.0 and 100.0 %%");
return (SOX_EOF);
}
if ((silence->start_unit == 'd') && (silence->start_threshold >= 0.0))
{
- sox_fail("silence threshold should be less than 0.0 dB");
+ lsx_fail("silence threshold should be less than 0.0 dB");
return(SOX_EOF);
}
}
@@ -200,18 +200,18 @@
{
if ((silence->stop_unit != '%') && (silence->stop_unit != 'd'))
{
- sox_fail("Invalid unit specified");
+ lsx_fail("Invalid unit specified");
return(SOX_EOF);
}
if ((silence->stop_unit == '%') && ((silence->stop_threshold < 0.0) ||
(silence->stop_threshold > 100.0)))
{
- sox_fail("silence threshold should be between 0.0 and 100.0 %%");
+ lsx_fail("silence threshold should be between 0.0 and 100.0 %%");
return (SOX_EOF);
}
if ((silence->stop_unit == 'd') && (silence->stop_threshold >= 0.0))
{
- sox_fail("silence threshold should be less than 0.0 dB");
+ lsx_fail("silence threshold should be less than 0.0 dB");
return(SOX_EOF);
}
}
--- a/src/skeleff.c
+++ b/src/skeleff.c
@@ -46,7 +46,7 @@
static int start(sox_effect_t * effp)
{
if (effp->out_signal.channels == 1) {
- sox_fail("Can't run on mono data.");
+ lsx_fail("Can't run on mono data.");
return SOX_EOF;
}
--- a/src/skelform.c
+++ b/src/skelform.c
@@ -92,12 +92,12 @@
*buf++ = SOX_UNSIGNED_8BIT_TO_SAMPLE(sample,);
break;
default:
- sox_fail("Undetected sample encoding in read!");
+ lsx_fail("Undetected sample encoding in read!");
exit(2);
}
break;
default:
- sox_fail("Undetected bad sample size in read!");
+ lsx_fail("Undetected bad sample size in read!");
exit(2);
}
}
@@ -124,15 +124,15 @@
* just set the length to max value and not fail.
*/
if (!ft->seekable) {
- sox_fail("Output .skel file must be a file, not a pipe");
+ lsx_fail("Output .skel file must be a file, not a pipe");
return SOX_EOF;
}
if (ft->signal.rate != 44100)
- sox_fail("Output .skel file must have a sample rate of 44100Hz");
+ lsx_fail("Output .skel file must have a sample rate of 44100Hz");
if (ft->encoding.bits_per_sample == 0) {
- sox_fail("Did not specify a size for .skel output file");
+ lsx_fail("Did not specify a size for .skel output file");
return SOX_EOF;
}
@@ -164,12 +164,12 @@
++done;
break;
default:
- sox_fail("Undetected bad sample encoding in write!");
+ lsx_fail("Undetected bad sample encoding in write!");
exit(2);
}
break;
default:
- sox_fail("Undetected bad sample size in write!");
+ lsx_fail("Undetected bad sample size in write!");
exit(2);
}
return done;
--- a/src/smp.c
+++ b/src/smp.c
@@ -276,18 +276,18 @@
smp->dataStart = samplestart;
ft->signal.length = smp->NoOfSamps;
- sox_report("SampleVision trailer:");
+ lsx_report("SampleVision trailer:");
for(i = 0; i < 8; i++) if (1 || trailer.loops[i].count) {
- sox_report("Loop %lu: start: %6d", (unsigned long)i, trailer.loops[i].start);
- sox_report(" end: %6d", trailer.loops[i].end);
- sox_report(" count: %6d", trailer.loops[i].count);
+ lsx_report("Loop %lu: start: %6d", (unsigned long)i, trailer.loops[i].start);
+ lsx_report(" end: %6d", trailer.loops[i].end);
+ lsx_report(" count: %6d", trailer.loops[i].count);
switch(trailer.loops[i].type) {
- case 0: sox_report("type: off"); break;
- case 1: sox_report("type: forward"); break;
- case 2: sox_report("type: forward/backward"); break;
+ case 0: lsx_report("type: off"); break;
+ case 1: lsx_report("type: forward"); break;
+ case 2: lsx_report("type: forward/backward"); break;
}
}
- sox_report("MIDI Note number: %d", trailer.MIDInote);
+ lsx_report("MIDI Note number: %d", trailer.MIDInote);
ft->oob.instr.nloops = 0;
for(i = 0; i < 8; i++)
--- a/src/sndfile.c
+++ b/src/sndfile.c
@@ -56,7 +56,7 @@
end = strchr(sf->log_buffer_ptr, '\0');
if (!strncmp(sf->log_buffer_ptr, warning_prefix, strlen(warning_prefix))) {
sf->log_buffer_ptr += strlen(warning_prefix);
- sox_warn("`%s': %.*s",
+ lsx_warn("`%s': %.*s",
ft->filename, (int)(end - sf->log_buffer_ptr), sf->log_buffer_ptr);
} else
lsx_debug("`%s': %.*s",
@@ -231,19 +231,19 @@
ft->signal.length = length;
if (channels && ft->signal.channels && ft->signal.channels != channels)
- sox_warn("`%s': overriding number of channels", ft->filename);
+ lsx_warn("`%s': overriding number of channels", ft->filename);
else ft->signal.channels = channels;
if (rate && ft->signal.rate && ft->signal.rate != rate)
- sox_warn("`%s': overriding sample rate", ft->filename);
+ lsx_warn("`%s': overriding sample rate", ft->filename);
else ft->signal.rate = rate;
if (encoding && ft->encoding.encoding && ft->encoding.encoding != encoding)
- sox_warn("`%s': overriding encoding type", ft->filename);
+ lsx_warn("`%s': overriding encoding type", ft->filename);
else ft->encoding.encoding = encoding;
if (bits_per_sample && ft->encoding.bits_per_sample && ft->encoding.bits_per_sample != bits_per_sample)
- sox_warn("`%s': overriding encoding size", ft->filename);
+ lsx_warn("`%s': overriding encoding size", ft->filename);
ft->encoding.bits_per_sample = bits_per_sample;
if (sox_precision(ft->encoding.encoding, ft->encoding.bits_per_sample))
@@ -282,7 +282,7 @@
/* Don't believe LSF's rate for raw files */
if ((sf->sf_info->format & SF_FORMAT_TYPEMASK) == SF_FORMAT_RAW && !ft->signal.rate) {
- sox_warn("'%s': sample rate not specified; trying 8kHz", ft->filename);
+ lsx_warn("'%s': sample rate not specified; trying 8kHz", ft->filename);
rate = 8000;
}
else rate = sf->sf_info->samplerate;
@@ -345,11 +345,11 @@
}
if (!sf_format_check(sf->sf_info)) {
- sox_fail("cannot find a usable output encoding");
+ lsx_fail("cannot find a usable output encoding");
return SOX_EOF;
}
if ((sf->sf_info->format & SF_FORMAT_TYPEMASK) != SF_FORMAT_RAW)
- sox_warn("cannot use desired output encoding, choosing default");
+ lsx_warn("cannot use desired output encoding, choosing default");
}
sf->sf_file = sf_open_fd(fileno(ft->fp), SFM_WRITE, sf->sf_info, 1);
--- a/src/sox.c
+++ b/src/sox.c
@@ -87,10 +87,10 @@
static sox_bool interactive = sox_false;
static sox_bool uservolume = sox_false;
typedef enum {RG_off, RG_track, RG_album} rg_mode;
-static sox_enum_item const rg_modes[] = {
- ENUM_ITEM(RG_,off)
- ENUM_ITEM(RG_,track)
- ENUM_ITEM(RG_,album)
+static lsx_enum_item const rg_modes[] = {
+ LSX_ENUM_ITEM(RG_,off)
+ LSX_ENUM_ITEM(RG_,track)
+ LSX_ENUM_ITEM(RG_,album)
{0, 0}};
static rg_mode replay_gain_mode = RG_off;
static sox_option_t show_progress = SOX_OPTION_DEFAULT;
@@ -248,7 +248,7 @@
fprintf(output, "\n");
if (f && f->replay_gain != HUGE_VAL){
- sprintf(buffer, "%s gain: %+.1fdB", sox_find_enum_value(f->replay_gain_mode, rg_modes)->text, f->replay_gain);
+ sprintf(buffer, "%s gain: %+.1fdB", lsx_find_enum_value(f->replay_gain_mode, rg_modes)->text, f->replay_gain);
buffer[0] += 'A' - 'a';
fprintf(output, "%-24s", buffer);
} else
@@ -269,7 +269,7 @@
{
static char const * const no_yes[] = {"no", "yes"};
FILE * const output = sox_mode == sox_soxi? stdout : stderr;
- char const * filetype = sox_find_file_extension(ft->filename);
+ char const * filetype = lsx_find_file_extension(ft->filename);
sox_bool show_type = sox_true;
size_t i;
@@ -326,7 +326,7 @@
if (f && f->replay_gain != HUGE_VAL)
fprintf(output, "Replay gain : %+g dB (%s)\n" , f->replay_gain,
- sox_find_enum_value(f->replay_gain_mode, rg_modes)->text);
+ lsx_find_enum_value(f->replay_gain_mode, rg_modes)->text);
if (f && f->volume != HUGE_VAL)
fprintf(output, "Level adjust : %g (linear gain)\n" , f->volume);
@@ -360,7 +360,7 @@
"Invalid argument",
"Unsupported file format",
};
- sox_fail("%s: %s: %s", ft->filename, ft->sox_errstr,
+ lsx_fail("%s: %s: %s", ft->filename, ft->sox_errstr,
ft->sox_errno < SOX_EHDR?
strerror(ft->sox_errno) : sox_strerror[ft->sox_errno - SOX_EHDR]);
}
@@ -575,10 +575,10 @@
effp = sox_create_effect(sox_find_effect(name)); /* Should always succeed. */
if (!effp)
- sox_fail("Failed creating effect. Out of Memory?\n");
+ lsx_fail("Failed creating effect. Out of Memory?\n");
if (effp->handler.flags & SOX_EFF_DEPRECATED)
- sox_warn("effect `%s' is deprecated; see sox(1) for an alternative",
+ lsx_warn("effect `%s' is deprecated; see sox(1) for an alternative",
effp->handler.name);
if (sox_effect_options(effp, argc, argv) == SOX_EOF)
@@ -656,7 +656,7 @@
eff_offset = nuser_effects[eff_chain_count];
if (eff_offset >= MAX_USER_EFF) {
- sox_fail("too many effects specified (at most %i allowed)", MAX_USER_EFF);
+ lsx_fail("too many effects specified (at most %i allowed)", MAX_USER_EFF);
exit(1);
}
@@ -794,11 +794,11 @@
if (file == NULL)
{
- sox_fail("Cannot open effects file %s", filename);
+ lsx_fail("Cannot open effects file %s", filename);
exit(1);
}
- sox_report("Reading effects from file %s", filename);
+ lsx_report("Reading effects from file %s", filename);
while (fgets(s, FILENAME_MAX, file))
{
@@ -857,10 +857,10 @@
effp = sox_create_effect(sox_find_effect(user_effargs[current_eff_chain][i].name));
if (!effp)
- sox_fail("Failed creating effect. Out of Memory?\n");
+ lsx_fail("Failed creating effect. Out of Memory?\n");
if (effp->handler.flags & SOX_EFF_DEPRECATED)
- sox_warn("effect `%s' is deprecated; see sox(1) for an alternative",
+ lsx_warn("effect `%s' is deprecated; see sox(1) for an alternative",
effp->handler.name);
/* The failing effect should have displayed an error message */
@@ -930,7 +930,7 @@
for (i = 0; i < chain->length; ++i) {
sox_effect_t const * effp = &chain->effects[i][0];
- sox_report("effects chain: %-10s %gHz %u channels %u bits %s",
+ lsx_report("effects chain: %-10s %gHz %u channels %u bits %s",
effp->handler.name, effp->in_signal.rate, effp->in_signal.channels, effp->in_signal.precision,
(effp->handler.flags & SOX_EFF_MCHAN)? "(multi)" : "");
}
@@ -1067,9 +1067,9 @@
percentage = max(100. * read_wide_samples / input_wide_samples, 0);
}
fprintf(stderr, "\rIn:%-5s %s [%s] Out:%-5s [%6s|%-6s] %s Clip:%-5s",
- sox_sigfigs3p(percentage), str_time(read_time), str_time(left_time),
- sox_sigfigs3(output_samples),
- vu(0), vu(1), headroom(), sox_sigfigs3(total_clips()));
+ lsx_sigfigs3p(percentage), str_time(read_time), str_time(left_time),
+ lsx_sigfigs3(output_samples),
+ vu(0), vu(1), headroom(), lsx_sigfigs3(total_clips()));
}
if (all_done)
fputc('\n', stderr);
@@ -1145,10 +1145,10 @@
char c;
if (!interactive) {
- sox_report("Overwriting `%s'", filename);
+ lsx_report("Overwriting `%s'", filename);
return sox_true;
}
- sox_warn("Output file `%s' already exists", filename);
+ lsx_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);
@@ -1284,7 +1284,7 @@
free(expand_fn);
if (!ofile->ft)
- /* sox_open_write() will call sox_warn for most errors.
+ /* sox_open_write() will call lsx_warn for most errors.
* Rely on that printing something. */
exit(2);
@@ -1359,14 +1359,14 @@
/* Check for invalid/unusual rate or channel combinations: */
if (min_rate != max_rate)
- sox_fail("Input files must have the same sample-rate");
+ lsx_fail("Input files must have the same sample-rate");
/* Don't exit quite yet; give the user any other message 1st */
if (min_channels != max_channels) {
if (combine_method == sox_concatenate) {
- sox_fail("Input files must have the same # channels");
+ lsx_fail("Input files must have the same # channels");
exit(1);
} else if (combine_method != sox_merge)
- sox_warn("Input files don't have the same # channels");
+ lsx_warn("Input files don't have the same # channels");
}
if (min_rate != max_rate)
exit(1);
@@ -1760,7 +1760,7 @@
FILE * file = fopen(filename, "rt");
if (file == NULL) {
- sox_fail("Cannot open comment file %s", filename);
+ lsx_fail("Cannot open comment file %s", filename);
exit(1);
}
do {
@@ -1772,7 +1772,7 @@
text[i++] = c;
}
if (ferror(file)) {
- sox_fail("Error reading comment file %s", filename);
+ lsx_fail("Error reading comment file %s", filename);
exit(1);
}
if (i) {
@@ -1830,26 +1830,26 @@
return -1;
}
-static sox_enum_item const combine_methods[] = {
- ENUM_ITEM(sox_,sequence)
- ENUM_ITEM(sox_,concatenate)
- ENUM_ITEM(sox_,mix)
+static lsx_enum_item const combine_methods[] = {
+ LSX_ENUM_ITEM(sox_,sequence)
+ LSX_ENUM_ITEM(sox_,concatenate)
+ LSX_ENUM_ITEM(sox_,mix)
{"mix-power", sox_mix_power},
- ENUM_ITEM(sox_,merge)
- ENUM_ITEM(sox_,multiply)
+ LSX_ENUM_ITEM(sox_,merge)
+ LSX_ENUM_ITEM(sox_,multiply)
{0, 0}};
enum {ENDIAN_little, ENDIAN_big, ENDIAN_swap};
-static sox_enum_item const endian_options[] = {
- ENUM_ITEM(ENDIAN_,little)
- ENUM_ITEM(ENDIAN_,big)
- ENUM_ITEM(ENDIAN_,swap)
+static lsx_enum_item const endian_options[] = {
+ LSX_ENUM_ITEM(ENDIAN_,little)
+ LSX_ENUM_ITEM(ENDIAN_,big)
+ LSX_ENUM_ITEM(ENDIAN_,swap)
{0, 0}};
-static sox_enum_item const plot_methods[] = {
- ENUM_ITEM(sox_plot_,off)
- ENUM_ITEM(sox_plot_,octave)
- ENUM_ITEM(sox_plot_,gnuplot)
+static lsx_enum_item const plot_methods[] = {
+ LSX_ENUM_ITEM(sox_plot_,off)
+ LSX_ENUM_ITEM(sox_plot_,octave)
+ LSX_ENUM_ITEM(sox_plot_,gnuplot)
{0, 0}};
enum {
@@ -1857,7 +1857,7 @@
encoding_ms_adpcm, encoding_ima_adpcm, encoding_oki_adpcm,
encoding_gsm_full_rate, encoding_u_law, encoding_a_law};
-static sox_enum_item const encodings[] = {
+static lsx_enum_item const encodings[] = {
{"signed-integer", encoding_signed_integer},
{"unsigned-integer", encoding_unsigned_integer},
{"floating-point", encoding_floating_point},
@@ -1870,9 +1870,9 @@
{"a-law", encoding_a_law},
{0, 0}};
-static int enum_option(int option_index, sox_enum_item const * items)
+static int enum_option(int option_index, lsx_enum_item const * items)
{
- sox_enum_item const * p = sox_find_enum_text(optarg, items);
+ lsx_enum_item const * p = lsx_find_enum_text(optarg, items);
if (p == NULL) {
size_t len = 1;
char * set = lsx_malloc(len);
@@ -1881,7 +1881,7 @@
set = lsx_realloc(set, len += 2 + strlen(p->text));
strcat(set, ", "); strcat(set, p->text);
}
- sox_fail("--%s: '%s' is not one of: %s.",
+ lsx_fail("--%s: '%s' is not one of: %s.",
long_options[option_index].name, optarg, set + 2);
free(set);
exit(1);
@@ -1910,7 +1910,7 @@
case 1:
#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);
+ lsx_fail("Buffer size `%s' must be > %d", optarg, SOX_BUFMIN);
exit(1);
}
sox_globals.bufsiz = i;
@@ -1943,7 +1943,7 @@
case 6:
if (sscanf(optarg, "%i %c", &i, &dummy) != 1 || i <= SOX_BUFMIN) {
- sox_fail("Buffer size `%s' must be > %d", optarg, SOX_BUFMIN);
+ lsx_fail("Buffer size `%s' must be > %d", optarg, SOX_BUFMIN);
exit(1);
}
sox_globals.input_bufsiz = i;
@@ -2011,7 +2011,7 @@
char k = 0;
size_t n = sscanf(optarg, "%lf %c %c", &f->signal.rate, &k, &dummy);
if (n < 1 || f->signal.rate <= 0 || (n > 1 && k != 'k') || n > 2) {
- sox_fail("Rate value `%s' is not a positive number", optarg);
+ lsx_fail("Rate value `%s' is not a positive number", optarg);
exit(1);
}
f->signal.rate *= k == 'k'? 1000. : 1.;
@@ -2020,18 +2020,18 @@
case 'v':
if (sscanf(optarg, "%lf %c", &f->volume, &dummy) != 1) {
- sox_fail("Volume value `%s' is not a number", optarg);
+ lsx_fail("Volume value `%s' is not a number", optarg);
exit(1);
}
uservolume = sox_true;
if (f->volume < 0.0)
- sox_report("Volume adjustment is negative; "
+ lsx_report("Volume adjustment is negative; "
"this will result in a phase change");
break;
case 'c':
if (sscanf(optarg, "%i %c", &i, &dummy) != 1 || i <= 0) {
- sox_fail("Channels value `%s' is not a positive integer", optarg);
+ lsx_fail("Channels value `%s' is not a positive integer", optarg);
exit(1);
}
f->signal.channels = i;
@@ -2039,7 +2039,7 @@
case 'C':
if (sscanf(optarg, "%lf %c", &f->encoding.compression, &dummy) != 1) {
- sox_fail("Compression value `%s' is not a number", optarg);
+ lsx_fail("Compression value `%s' is not a number", optarg);
exit(1);
}
break;
@@ -2046,7 +2046,7 @@
case 'b':
if (sscanf(optarg, "%i %c", &i, &dummy) != 1 || i <= 0) {
- sox_fail("Bits value `%s' is not a positive integer", optarg);
+ lsx_fail("Bits value `%s' is not a positive integer", optarg);
exit(1);
}
f->encoding.bits_per_sample = i;
@@ -2116,7 +2116,7 @@
else {
if (sscanf(optarg, "%i %c", &i, &dummy) != 1 || i < 0) {
sox_globals.verbosity = 2;
- sox_fail("Verbosity value `%s' is not a non-negative integer", optarg);
+ lsx_fail("Verbosity value `%s' is not a non-negative integer", optarg);
exit(1);
}
sox_globals.verbosity = (unsigned)i;
@@ -2150,7 +2150,7 @@
f->filetype = "ao";
if (!f->filetype) {
- sox_fail("Sorry, there is no default audio device configured");
+ lsx_fail("Sorry, there is no default audio device configured");
exit(1);
}
return device_name(f->filetype);
@@ -2189,7 +2189,7 @@
char c = parse_gopts_and_fopts(&opts, argc, argv);
if (c == 'n') { /* is null file? */
if (opts.filetype != NULL && strcmp(opts.filetype, "null") != 0)
- sox_warn("ignoring `-t %s'.", opts.filetype);
+ lsx_warn("ignoring `-t %s'.", opts.filetype);
opts.filetype = "null";
add_file(&opts, "");
}
@@ -2252,7 +2252,7 @@
else {
if (sscanf(optarg, "%i %c", &i, &dummy) != 1 || i < 0) {
sox_globals.verbosity = 2;
- sox_fail("Verbosity value `%s' is not a non-negative integer", optarg);
+ lsx_fail("Verbosity value `%s' is not a non-negative integer", optarg);
exit(1);
}
sox_globals.verbosity = (unsigned)i;
@@ -2387,7 +2387,7 @@
}
files[j]->ft = sox_open_read(f->filename, &f->signal, &f->encoding, f->filetype);
if (!files[j]->ft)
- /* sox_open_read() will call sox_warn for most errors.
+ /* sox_open_read() will call lsx_warn for most errors.
* Rely on that printing something. */
exit(2);
if (show_progress == SOX_OPTION_DEFAULT &&
@@ -2469,7 +2469,7 @@
for (i = 0; i < file_count; ++i)
if (files[i]->ft->clips != 0)
- sox_warn(i < input_count?"%s: input clipped %lu samples" :
+ lsx_warn(i < input_count?"%s: input clipped %lu samples" :
"%s: output clipped %lu samples; decrease volume?",
(files[i]->ft->handler.flags & SOX_FILE_DEVICE)?
files[i]->ft->handler.names[0] : files[i]->ft->filename,
@@ -2476,11 +2476,11 @@
(unsigned long)files[i]->ft->clips);
if (mixing_clips > 0)
- sox_warn("mix-combining clipped %lu samples; decrease volume?", (unsigned long)mixing_clips);
+ lsx_warn("mix-combining clipped %lu samples; decrease volume?", (unsigned long)mixing_clips);
for (i = 0; i < file_count; i++)
if (files[i]->volume_clips > 0)
- sox_warn("%s: balancing clipped %lu samples; decrease volume?",
+ lsx_warn("%s: balancing clipped %lu samples; decrease volume?",
files[i]->filename, (unsigned long)files[i]->volume_clips);
if (show_progress) {
--- a/src/sox.h
+++ b/src/sox.h
@@ -538,22 +538,24 @@
* in public API because sox (the application) make use of them but
* may not be supported and may change rapidly.
*/
-void sox_fail(const char *, ...) PRINTF;
-void sox_warn(const char *, ...) PRINTF;
-void sox_report(const char *, ...) PRINTF;
+void lsx_fail(const char *, ...) PRINTF;
+void lsx_warn(const char *, ...) PRINTF;
+void lsx_report(const char *, ...) PRINTF;
+void lsx_debug(const char *, ...) PRINTF;
-#define sox_fail sox_globals.subsystem=__FILE__,sox_fail
-#define sox_warn sox_globals.subsystem=__FILE__,sox_warn
-#define sox_report sox_globals.subsystem=__FILE__,sox_report
+#define lsx_fail sox_globals.subsystem=__FILE__,lsx_fail
+#define lsx_warn sox_globals.subsystem=__FILE__,lsx_warn
+#define lsx_report sox_globals.subsystem=__FILE__,lsx_report
+#define lsx_debug sox_globals.subsystem=__FILE__,lsx_debug
-typedef struct {char const *text; unsigned value;} sox_enum_item;
-#define ENUM_ITEM(prefix, item) {#item, prefix##item},
+typedef struct {char const *text; unsigned value;} lsx_enum_item;
+#define LSX_ENUM_ITEM(prefix, item) {#item, prefix##item},
-sox_enum_item const * sox_find_enum_text(char const * text, sox_enum_item const * sox_enum_items);
-sox_enum_item const * sox_find_enum_value(unsigned value, sox_enum_item const * sox_enum_items);
-char const * sox_find_file_extension(char const * pathname);
-char const * sox_sigfigs3(size_t number);
-char const * sox_sigfigs3p(double percentage);
+lsx_enum_item const * lsx_find_enum_text(char const * text, lsx_enum_item const * lsx_enum_items);
+lsx_enum_item const * lsx_find_enum_value(unsigned value, lsx_enum_item const * lsx_enum_items);
+char const * lsx_find_file_extension(char const * pathname);
+char const * lsx_sigfigs3(size_t number);
+char const * lsx_sigfigs3p(double percentage);
/* WARNING END */
#endif
--- a/src/sox_i.h
+++ b/src/sox_i.h
@@ -20,7 +20,7 @@
#include <errno.h>
typedef enum {SOX_SHORT, SOX_INT, SOX_FLOAT, SOX_DOUBLE} sox_data_t;
typedef enum {SOX_WAVE_SINE, SOX_WAVE_TRIANGLE} lsx_wave_t;
-extern sox_enum_item const lsx_wave_enum[];
+extern lsx_enum_item const lsx_wave_enum[];
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> /* For off_t not found in stdio.h */
@@ -47,11 +47,9 @@
#define FMT_size_t "lu"
#endif
-void lsx_debug(const char *, ...) PRINTF;
void lsx_debug_more(char const * fmt, ...) PRINTF;
void lsx_debug_most(char const * fmt, ...) PRINTF;
-#define lsx_debug sox_globals.subsystem=__FILE__,lsx_debug
#define lsx_debug_more sox_globals.subsystem=__FILE__,lsx_debug_more
#define lsx_debug_most sox_globals.subsystem=__FILE__,lsx_debug_most
@@ -227,7 +225,7 @@
d = strtod(*argv, &end_ptr); \
if (end_ptr != *argv) { \
if (d < min || d > max || *end_ptr != '\0') {\
- sox_fail("parameter `%s' must be between %g and %g", #name, (double)min, (double)max); \
+ lsx_fail("parameter `%s' must be between %g and %g", #name, (double)min, (double)max); \
return lsx_usage(effp); \
} \
p->name = d; \
@@ -236,9 +234,9 @@
}
#define TEXTUAL_PARAMETER(name, enum_table) { \
- sox_enum_item const * e; \
+ lsx_enum_item const * e; \
if (argc == 0) break; \
- e = sox_find_enum_text(*argv, enum_table); \
+ e = lsx_find_enum_text(*argv, enum_table); \
if (e != NULL) { \
p->name = e->value; \
--argc, ++argv; \
@@ -249,7 +247,7 @@
char * end_ptr; \
double d = strtod(optarg, &end_ptr); \
if (end_ptr == optarg || d < min || d > max || *end_ptr != '\0') {\
- sox_fail("parameter `%s' must be between %g and %g", #name, (double)min, (double)max); \
+ lsx_fail("parameter `%s' must be between %g and %g", #name, (double)min, (double)max); \
return lsx_usage(effp); \
} \
p->name = d; \
--- a/src/spectrogram.c
+++ b/src/spectrogram.c
@@ -41,12 +41,12 @@
#define MAX_COLS 999 /* Also max seconds */
typedef enum {Window_Hann, Window_Hamming, Window_Bartlett, Window_Rectangular, Window_Kaiser} win_type_t;
-static sox_enum_item const window_options[] = {
- ENUM_ITEM(Window_,Hann)
- ENUM_ITEM(Window_,Hamming)
- ENUM_ITEM(Window_,Bartlett)
- ENUM_ITEM(Window_,Rectangular)
- ENUM_ITEM(Window_,Kaiser)
+static lsx_enum_item const window_options[] = {
+ LSX_ENUM_ITEM(Window_,Hann)
+ LSX_ENUM_ITEM(Window_,Hamming)
+ LSX_ENUM_ITEM(Window_,Bartlett)
+ LSX_ENUM_ITEM(Window_,Rectangular)
+ LSX_ENUM_ITEM(Window_,Kaiser)
{0, 0}};
typedef struct {
@@ -72,9 +72,9 @@
#define secs(cols) \
((double)(cols) * p->step_size * p->block_steps / effp->in_signal.rate)
-static int enum_option(int c, sox_enum_item const * items)
+static int enum_option(int c, lsx_enum_item const * items)
{
- sox_enum_item const * p = sox_find_enum_text(optarg, items);
+ lsx_enum_item const * p = lsx_find_enum_text(optarg, items);
if (p == NULL) {
size_t len = 1;
char * set = lsx_malloc(len);
@@ -83,7 +83,7 @@
set = lsx_realloc(set, len += 2 + strlen(p->text));
strcat(set, ", "); strcat(set, p->text);
}
- sox_fail("-%c: '%s' is not one of: %s.", c, optarg, set + 2);
+ lsx_fail("-%c: '%s' is not one of: %s.", c, optarg, set + 2);
free(set);
return INT_MAX;
}
@@ -117,7 +117,7 @@
case 'l': p->light_background = sox_true; break;
case 'h': p->high_colour = sox_true; break;
case 'o': p->out_name = optarg; break;
- default: sox_fail("unknown option `-%c'", optopt); return lsx_usage(effp);
+ default: lsx_fail("unknown option `-%c'", optopt); return lsx_usage(effp);
}
p->gain = -p->gain;
--p->y_size, --p->perm;
@@ -151,7 +151,7 @@
double actual;
if (effp->in_signal.channels != 1) {
- sox_fail("only 1 channel is supported");
+ lsx_fail("only 1 channel is supported");
return SOX_EOF;
}
memset(&p->WORK, 0, sizeof(*p) - field_offset(priv_t, WORK));
@@ -166,7 +166,7 @@
p->block_norm = 1. / p->block_steps;
actual = effp->in_signal.rate / p->step_size / p->block_steps;
if (actual != p->pixels_per_sec)
- sox_report("actual pixels/s = %g", actual);
+ lsx_report("actual pixels/s = %g", actual);
lsx_debug("step_size=%i block_steps=%i", p->step_size, p->block_steps);
p->max = -p->dB_range;
p->read = (p->step_size - p->dft_size) / 2;
@@ -179,7 +179,7 @@
int i;
if (p->cols == MAX_COLS) {
- sox_warn("PNG truncated at %g seconds", secs(p->cols));
+ lsx_warn("PNG truncated at %g seconds", secs(p->cols));
p->truncated = sox_true;
return SOX_EOF;
}
@@ -412,7 +412,7 @@
double limit;
if (!file) {
- sox_fail("failed to create `%s' :(", p->out_name);
+ lsx_fail("failed to create `%s' :(", p->out_name);
png_destroy_write_struct(&png, &png_info);
free(png_rows);
free(pixels);
--- a/src/splice.c
+++ b/src/splice.c
@@ -220,7 +220,7 @@
{
priv_t * p = (priv_t *)effp->priv;
if (p->splices_pos != p->nsplices)
- sox_warn("Input audio too short; splices not made: %u", p->nsplices - p->splices_pos);
+ lsx_warn("Input audio too short; splices not made: %u", p->nsplices - p->splices_pos);
free(p->buffer);
return SOX_SUCCESS;
}
--- a/src/stat.c
+++ b/src/stat.c
@@ -54,12 +54,12 @@
stat->volume = 1;
else if (!(strcmp(*argv, "-s"))) {
if (n <= 1) {
- sox_fail("-s option: invalid argument");
+ lsx_fail("-s option: invalid argument");
return SOX_EOF;
}
n--, argv++; /* Move to next argument. */
if (!sscanf(*argv, "%lf", &stat->scale)) {
- sox_fail("-s option: invalid argument");
+ lsx_fail("-s option: invalid argument");
return SOX_EOF;
}
} else if (!(strcmp(*argv, "-rms")))
@@ -69,7 +69,7 @@
else if (!(strcmp(*argv, "-d")))
stat->volume = 2;
else {
- sox_fail("Summary effect: unknown option");
+ lsx_fail("Summary effect: unknown option");
return SOX_EOF;
}
}
--- a/src/stretch.c
+++ b/src/stretch.c
@@ -65,12 +65,12 @@
p->window = DEFAULT_STRETCH_WINDOW;
if (n > 0 && !sscanf(argv[0], "%lf", &p->factor)) {
- sox_fail("error while parsing factor");
+ lsx_fail("error while parsing factor");
return lsx_usage(effp);
}
if (n > 1 && !sscanf(argv[1], "%lf", &p->window)) {
- sox_fail("error while parsing window size");
+ lsx_fail("error while parsing window size");
return lsx_usage(effp);
}
@@ -80,7 +80,7 @@
case 'L':
break;
default:
- sox_fail("error while parsing fade type");
+ lsx_fail("error while parsing fade type");
return lsx_usage(effp);
}
}
@@ -90,12 +90,12 @@
DEFAULT_FAST_SHIFT_RATIO: DEFAULT_SLOW_SHIFT_RATIO;
if (n > 3 && !sscanf(argv[3], "%lf", &p->shift)) {
- sox_fail("error while parsing shift ratio");
+ lsx_fail("error while parsing shift ratio");
return lsx_usage(effp);
}
if (p->shift > 1.0 || p->shift <= 0.0) {
- sox_fail("error with shift ratio value");
+ lsx_fail("error with shift ratio value");
return lsx_usage(effp);
}
@@ -109,12 +109,12 @@
p->fading = 0.5;
if (n > 4 && !sscanf(argv[4], "%lf", &p->fading)) {
- sox_fail("error while parsing fading ratio");
+ lsx_fail("error while parsing fading ratio");
return lsx_usage(effp);
}
if (p->fading > 0.5 || p->fading < 0.0) {
- sox_fail("error with fading ratio value");
+ lsx_fail("error with fading ratio value");
return lsx_usage(effp);
}
--- a/src/sunaudio.c
+++ b/src/sunaudio.c
@@ -68,7 +68,7 @@
lsx_fail_errno(ft,errno,"Unable to get device information.");
return(SOX_EOF);
}
- sox_report("Hardware detected: %s",audio_dev.name);
+ lsx_report("Hardware detected: %s",audio_dev.name);
if (strcmp("SUNW,am79c30",audio_dev.name) == 0)
{
simple_hw = 1;
@@ -83,13 +83,13 @@
if (ft->encoding.encoding != SOX_ENCODING_ULAW &&
ft->encoding.encoding != SOX_ENCODING_ALAW)
{
- sox_report("Warning: Detected simple hardware. Forcing output to ULAW");
+ lsx_report("Warning: Detected simple hardware. Forcing output to ULAW");
ft->encoding.encoding = SOX_ENCODING_ULAW;
}
}
else if (ft->encoding.bits_per_sample == 16)
{
- sox_report("Warning: Detected simple hardware. Forcing output to ULAW");
+ lsx_report("Warning: Detected simple hardware. Forcing output to ULAW");
ft->encoding.bits_per_sample = 8;
ft->encoding.encoding = SOX_ENCODING_ULAW;
}
@@ -107,7 +107,7 @@
ft->encoding.encoding == SOX_ENCODING_ALAW) &&
ft->signal.channels == 2)
{
- sox_report("Warning: only support mono for ULAW and ALAW data. Forcing to mono.");
+ lsx_report("Warning: only support mono for ULAW and ALAW data. Forcing to mono.");
ft->signal.channels = 1;
}
}
@@ -125,11 +125,11 @@
if (ft->signal.channels == 0) ft->signal.channels = 1;
else if (ft->signal.channels > 1) {
- sox_report("Warning: some Sun audio devices can not play stereo");
- sox_report("at all or sometimes only with signed words. If the");
- sox_report("sound seems sluggish then this is probably the case.");
- sox_report("Try forcing output to signed words or use the avg");
- sox_report("filter to reduce the number of channels.");
+ lsx_report("Warning: some Sun audio devices can not play stereo");
+ lsx_report("at all or sometimes only with signed words. If the");
+ lsx_report("sound seems sluggish then this is probably the case.");
+ lsx_report("Try forcing output to signed words or use the avg");
+ lsx_report("filter to reduce the number of channels.");
ft->signal.channels = 2;
}
@@ -202,7 +202,7 @@
lsx_fail_errno(ft,errno,"Unable to get device information.");
return(SOX_EOF);
}
- sox_report("Hardware detected: %s",audio_dev.name);
+ lsx_report("Hardware detected: %s",audio_dev.name);
if (strcmp("SUNW,am79c30",audio_dev.name) == 0)
{
simple_hw = 1;
@@ -216,13 +216,13 @@
if (ft->encoding.encoding != SOX_ENCODING_ULAW &&
ft->encoding.encoding != SOX_ENCODING_ALAW)
{
- sox_report("Warning: Detected simple hardware. Forcing output to ULAW");
+ lsx_report("Warning: Detected simple hardware. Forcing output to ULAW");
ft->encoding.encoding = SOX_ENCODING_ULAW;
}
}
else if (ft->encoding.bits_per_sample == 16)
{
- sox_report("Warning: Detected simple hardware. Forcing output to ULAW");
+ lsx_report("Warning: Detected simple hardware. Forcing output to ULAW");
ft->encoding.bits_per_sample = 8;
ft->encoding.encoding = SOX_ENCODING_ULAW;
}
@@ -236,8 +236,8 @@
else if (ft->encoding.encoding != SOX_ENCODING_ULAW &&
ft->encoding.encoding != SOX_ENCODING_ALAW &&
ft->encoding.encoding != SOX_ENCODING_SIGN2) {
- sox_report("Sun Audio driver only supports ULAW, ALAW, and Signed Linear for bytes.");
- sox_report("Forcing to ULAW");
+ lsx_report("Sun Audio driver only supports ULAW, ALAW, and Signed Linear for bytes.");
+ lsx_report("Forcing to ULAW");
ft->encoding.encoding = SOX_ENCODING_ULAW;
}
if ((ft->encoding.encoding == SOX_ENCODING_ULAW ||
@@ -244,7 +244,7 @@
ft->encoding.encoding == SOX_ENCODING_ALAW) &&
ft->signal.channels == 2)
{
- sox_report("Warning: only support mono for ULAW and ALAW data. Forcing to mono.");
+ lsx_report("Warning: only support mono for ULAW and ALAW data. Forcing to mono.");
ft->signal.channels = 1;
}
@@ -254,13 +254,13 @@
if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
ft->encoding.encoding = SOX_ENCODING_SIGN2;
else if (ft->encoding.encoding != SOX_ENCODING_SIGN2) {
- sox_report("Sun Audio driver only supports Signed Linear for words.");
- sox_report("Forcing to Signed Linear");
+ lsx_report("Sun Audio driver only supports Signed Linear for words.");
+ lsx_report("Forcing to Signed Linear");
ft->encoding.encoding = SOX_ENCODING_SIGN2;
}
}
else {
- sox_report("Sun Audio driver only supports bytes and words");
+ lsx_report("Sun Audio driver only supports bytes and words");
ft->encoding.bits_per_sample = 16;
ft->encoding.encoding = SOX_ENCODING_SIGN2;
samplesize = 16;
--- a/src/swap.c
+++ b/src/swap.c
@@ -63,7 +63,7 @@
if (effp->out_signal.channels == 1)
{
- sox_fail("Can't swap channels on mono data.");
+ lsx_fail("Can't swap channels on mono data.");
return (SOX_EOF);
}
@@ -77,12 +77,12 @@
if (swap->order[2] || swap->order[3])
{
- sox_fail("invalid swap channel options used");
+ lsx_fail("invalid swap channel options used");
}
if (swap->order[0] != 1 && swap->order[0] != 2)
- sox_fail("invalid swap channel options used");
+ lsx_fail("invalid swap channel options used");
if (swap->order[1] != 1 && swap->order[1] != 2)
- sox_fail("invalid swap channel options used");
+ lsx_fail("invalid swap channel options used");
/* Convert to array offsets */
swap->order[0]--;
@@ -100,13 +100,13 @@
}
if (swap->order[0] < 1 || swap->order[0] > 4)
- sox_fail("invalid swap channel options used");
+ lsx_fail("invalid swap channel options used");
if (swap->order[1] < 1 || swap->order[1] > 4)
- sox_fail("invalid swap channel options used");
+ lsx_fail("invalid swap channel options used");
if (swap->order[2] < 1 || swap->order[2] > 4)
- sox_fail("invalid swap channel options used");
+ lsx_fail("invalid swap channel options used");
if (swap->order[3] < 1 || swap->order[3] > 4)
- sox_fail("invalid swap channel options used");
+ lsx_fail("invalid swap channel options used");
/* Convert to array offsets */
swap->order[0]--;
--- a/src/synth.c
+++ b/src/synth.c
@@ -28,28 +28,28 @@
synth_brownnoise
} type_t;
-static sox_enum_item const synth_type[] = {
- ENUM_ITEM(synth_, sine)
- ENUM_ITEM(synth_, square)
- ENUM_ITEM(synth_, sawtooth)
- ENUM_ITEM(synth_, triangle)
- ENUM_ITEM(synth_, trapezium)
- ENUM_ITEM(synth_, trapetz)
- ENUM_ITEM(synth_, exp)
- ENUM_ITEM(synth_, whitenoise)
- ENUM_ITEM(synth_, noise)
- ENUM_ITEM(synth_, pinknoise)
- ENUM_ITEM(synth_, brownnoise)
+static lsx_enum_item const synth_type[] = {
+ LSX_ENUM_ITEM(synth_, sine)
+ LSX_ENUM_ITEM(synth_, square)
+ LSX_ENUM_ITEM(synth_, sawtooth)
+ LSX_ENUM_ITEM(synth_, triangle)
+ LSX_ENUM_ITEM(synth_, trapezium)
+ LSX_ENUM_ITEM(synth_, trapetz)
+ LSX_ENUM_ITEM(synth_, exp)
+ LSX_ENUM_ITEM(synth_, whitenoise)
+ LSX_ENUM_ITEM(synth_, noise)
+ LSX_ENUM_ITEM(synth_, pinknoise)
+ LSX_ENUM_ITEM(synth_, brownnoise)
{0, 0}
};
typedef enum {synth_create, synth_mix, synth_amod, synth_fmod} combine_t;
-static sox_enum_item const combine_type[] = {
- ENUM_ITEM(synth_, create)
- ENUM_ITEM(synth_, mix)
- ENUM_ITEM(synth_, amod)
- ENUM_ITEM(synth_, fmod)
+static lsx_enum_item const combine_type[] = {
+ LSX_ENUM_ITEM(synth_, create)
+ LSX_ENUM_ITEM(synth_, mix)
+ LSX_ENUM_ITEM(synth_, amod)
+ LSX_ENUM_ITEM(synth_, fmod)
{0, 0}
};
@@ -258,10 +258,10 @@
while (argn < argc) { /* type [combine] [f1[-f2] [p1 [p2 [p3 [p3 [p4]]]]]] */
channel_t chan;
char * end_ptr;
- sox_enum_item const *p = sox_find_enum_text(argv[argn], synth_type);
+ lsx_enum_item const *p = lsx_find_enum_text(argv[argn], synth_type);
if (p == NULL) {
- sox_fail("no type given");
+ lsx_fail("no type given");
return SOX_EOF;
}
synth->getopts_channels = lsx_realloc(synth->getopts_channels, sizeof(*synth->getopts_channels) * (synth->getopts_nchannels + 1));
@@ -272,7 +272,7 @@
break;
/* maybe there is a combine-type in next arg */
- p = sox_find_enum_text(argv[argn], combine_type);
+ p = lsx_find_enum_text(argv[argn], combine_type);
if (p != NULL) {
chan->combine = p->value;
if (++argn == argc)
@@ -286,7 +286,7 @@
chan->freq2 = chan->freq = lsx_parse_frequency(argv[argn], &end_ptr);
if (chan->freq < 0) {
- sox_fail("invalid freq");
+ lsx_fail("invalid freq");
return SOX_EOF;
}
if (*end_ptr && strchr(sweeps, *end_ptr)) { /* freq2 given? */
@@ -293,20 +293,20 @@
chan->sweep = strchr(sweeps, *end_ptr) - sweeps;
chan->freq2 = lsx_parse_frequency(end_ptr + 1, &end_ptr);
if (chan->freq2 < 0) {
- sox_fail("invalid freq2");
+ lsx_fail("invalid freq2");
return SOX_EOF;
}
if (synth->length_str == NULL) {
- sox_fail("duration must be given when using freq2");
+ lsx_fail("duration must be given when using freq2");
return SOX_EOF;
}
}
if (*end_ptr) {
- sox_fail("frequency: invalid trailing character");
+ lsx_fail("frequency: invalid trailing character");
return SOX_EOF;
}
if (chan->sweep >= Exp && chan->freq * chan->freq2 == 0) {
- sox_fail("invalid frequency for exponential sweep");
+ lsx_fail("invalid frequency for exponential sweep");
return SOX_EOF;
}
@@ -322,7 +322,7 @@
if (end_ptr == argv[argn]) \
break; \
if (d < min || d > max || *end_ptr != '\0') { \
- sox_fail("parameter error"); \
+ lsx_fail("parameter error"); \
return SOX_EOF; \
} \
chan->p = d / 100; /* adjust so abs(parameter) <= 1 */\
@@ -389,8 +389,8 @@
}
lsx_debug("type=%s, combine=%s, samples_to_do=%lu, f1=%g, f2=%g, "
"offset=%g, phase=%g, p1=%g, p2=%g, p3=%g mult=%g",
- sox_find_enum_value(chan->type, synth_type)->text,
- sox_find_enum_value(chan->combine, combine_type)->text,
+ lsx_find_enum_value(chan->type, synth_type)->text,
+ lsx_find_enum_value(chan->combine, combine_type)->text,
(unsigned long)synth->samples_to_do, chan->freq, chan->freq2,
chan->offset, chan->phase, chan->p1, chan->p2, chan->p3, chan->mult);
}
--- a/src/tempo.c
+++ b/src/tempo.c
@@ -223,7 +223,7 @@
case 'm': profile = Music; break;
case 's': profile = Speech; break;
case 'l': profile = Linear; p->search_ms = 0; break;
- default: sox_fail("unknown option `-%c'", optopt); return lsx_usage(effp);
+ default: lsx_fail("unknown option `-%c'", optopt); return lsx_usage(effp);
}
argc -= optind, argv += optind;
do { /* break-able block */
@@ -241,7 +241,7 @@
p->search_ms = p->segment_ms / searches_div[profile];
p->overlap_ms = min(p->overlap_ms, p->segment_ms / 2);
- sox_report("quick_search=%u factor=%g segment=%g search=%g overlap=%g",
+ lsx_report("quick_search=%u factor=%g segment=%g search=%g overlap=%g",
p->quick_search, p->factor, p->segment_ms, p->search_ms, p->overlap_ms);
return argc? lsx_usage(effp) : SOX_SUCCESS;
}
--- a/src/tx16w.c
+++ b/src/tx16w.c
@@ -317,7 +317,7 @@
else WH.sample_rate = 2;
if (sk->samples_out >= TXMAXLEN) {
- sox_warn("Sound too large for TX16W. Truncating, Loop Off");
+ lsx_warn("Sound too large for TX16W. Truncating, Loop Off");
AttackLength = TXMAXLEN/2;
LoopLength = TXMAXLEN/2;
}
--- a/src/util.c
+++ b/src/util.c
@@ -36,7 +36,7 @@
}
#endif
-char const * sox_find_file_extension(char const * pathname)
+char const * lsx_find_file_extension(char const * pathname)
{
/* First, chop off any path portions of filename. This
* prevents the next search from considering that part. */
@@ -51,9 +51,9 @@
return result;
}
-sox_enum_item const * sox_find_enum_text(char const * text, sox_enum_item const * enum_items)
+lsx_enum_item const * lsx_find_enum_text(char const * text, lsx_enum_item const * enum_items)
{
- sox_enum_item const * result = NULL; /* Assume not found */
+ lsx_enum_item const * result = NULL; /* Assume not found */
while (enum_items->text) {
if (strcasecmp(text, enum_items->text) == 0)
@@ -68,7 +68,7 @@
return result;
}
-sox_enum_item const * sox_find_enum_value(unsigned value, sox_enum_item const * enum_items)
+lsx_enum_item const * lsx_find_enum_value(unsigned value, lsx_enum_item const * enum_items)
{
for (;enum_items->text; ++enum_items)
if (value == enum_items->value)
@@ -76,7 +76,7 @@
return NULL;
}
-char const * sox_sigfigs3(size_t number)
+char const * lsx_sigfigs3(size_t number)
{
static char string[16][10];
static unsigned n;
@@ -92,7 +92,7 @@
return string[n];
}
-char const * sox_sigfigs3p(double percentage)
+char const * lsx_sigfigs3p(double percentage)
{
static char string[16][10];
static unsigned n;
--- a/src/voc.c
+++ b/src/voc.c
@@ -291,7 +291,7 @@
v->size = 4;
break;
default:
- sox_fail("Unknown VOC format %d", v->format);
+ lsx_fail("Unknown VOC format %d", v->format);
rtn = SOX_EOF;
break;
}
@@ -348,7 +348,7 @@
if (v->size <= 4) {
if (!v->adpcm.setup.sign) {
if (lsx_readb(ft, &uc) == SOX_EOF) {
- sox_warn("VOC input: short file");
+ lsx_warn("VOC input: short file");
v->block_remaining = 0;
return done;
}
@@ -359,7 +359,7 @@
++done;
}
if (lsx_readb(ft, &uc) == SOX_EOF) {
- sox_warn("VOC input: short file");
+ lsx_warn("VOC input: short file");
v->block_remaining = 0;
return done;
}
@@ -405,7 +405,7 @@
switch (v->size) {
case 8:
if (lsx_readb(ft, &uc) == SOX_EOF) {
- sox_warn("VOC input: short file");
+ lsx_warn("VOC input: short file");
v->block_remaining = 0;
return done;
}
@@ -420,7 +420,7 @@
case 16:
lsx_readsw(ft, &sw);
if (lsx_eof(ft)) {
- sox_warn("VOC input: short file");
+ lsx_warn("VOC input: short file");
v->block_remaining = 0;
return done;
}
@@ -656,7 +656,7 @@
int8_t c /*, line_buf[80];
* int len = 0 */ ;
- sox_warn("VOC TEXT");
+ lsx_warn("VOC TEXT");
while (i--) {
lsx_readsb(ft, &c);
/* FIXME: this needs to be tested but I couldn't
@@ -666,7 +666,7 @@
if (len && (c == '\0' || c == '\r' ||
i == 0 || len == sizeof(line_buf) - 1))
{
- sox_report("%s", line_buf);
+ lsx_report("%s", line_buf);
line_buf[len] = '\0';
len = 0;
}
--- a/src/vol.c
+++ b/src/vol.c
@@ -26,10 +26,10 @@
enum {vol_amplitude, vol_dB, vol_power};
-static sox_enum_item const vol_types[] = {
- ENUM_ITEM(vol_,amplitude)
- ENUM_ITEM(vol_,dB)
- ENUM_ITEM(vol_,power)
+static lsx_enum_item const vol_types[] = {
+ LSX_ENUM_ITEM(vol_,amplitude)
+ LSX_ENUM_ITEM(vol_,dB)
+ LSX_ENUM_ITEM(vol_,power)
{0, 0}};
/*
@@ -59,7 +59,7 @@
}
if (have_type) {
- sox_enum_item const * p = sox_find_enum_text(type_ptr, vol_types);
+ lsx_enum_item const * p = lsx_find_enum_text(type_ptr, vol_types);
if (!p)
return lsx_usage(effp);
switch (p->value) {
@@ -168,7 +168,7 @@
{
priv_t * vol = (priv_t *) effp->priv;
if (vol->limited) {
- sox_warn("limited %d values (%d percent).",
+ lsx_warn("limited %d values (%d percent).",
vol->limited, (int) (vol->limited * 100.0 / vol->totalprocessed));
}
return SOX_SUCCESS;
--- a/src/vorbis.c
+++ b/src/vorbis.c
@@ -158,7 +158,7 @@
if (num_read == 0)
return (BUF_EOF);
else if (num_read == OV_HOLE)
- sox_warn("Warning: hole in stream; probably harmless");
+ lsx_warn("Warning: hole in stream; probably harmless");
else if (num_read < 0)
return (BUF_ERROR);
else
--- a/src/wav.c
+++ b/src/wav.c
@@ -127,7 +127,7 @@
samplesThisBlock = lsx_ima_samples_in((size_t)0, (size_t)ft->signal.channels, bytesRead, (size_t) 0);
if (samplesThisBlock == 0)
{
- sox_warn("Premature EOF on .wav input file");
+ lsx_warn("Premature EOF on .wav input file");
return 0;
}
}
@@ -168,7 +168,7 @@
samplesThisBlock = lsx_ms_adpcm_samples_in((size_t)0, (size_t)ft->signal.channels, bytesRead, (size_t)0);
if (samplesThisBlock == 0)
{
- sox_warn("Premature EOF on .wav input file");
+ lsx_warn("Premature EOF on .wav input file");
return 0;
}
}
@@ -176,7 +176,7 @@
errmsg = lsx_ms_adpcm_block_expand_i(ft->signal.channels, wav->nCoefs, wav->lsx_ms_adpcm_i_coefs, wav->packet, wav->samples, samplesThisBlock);
if (errmsg)
- sox_warn(errmsg);
+ lsx_warn(errmsg);
return samplesThisBlock;
}
@@ -274,7 +274,7 @@
if (bytes <=0)
return done;
if (bytes<65) {
- sox_warn("invalid wav gsm frame size: %d bytes",bytes);
+ lsx_warn("invalid wav gsm frame size: %d bytes",bytes);
return done;
}
/* decode the long 33 byte half */
@@ -529,7 +529,7 @@
/* Default (-1) depends on sample size. Set that later on. */
if (ft->encoding.encoding != SOX_ENCODING_UNKNOWN && ft->encoding.encoding != SOX_ENCODING_UNSIGNED &&
ft->encoding.encoding != SOX_ENCODING_SIGN2)
- sox_report("User options overriding encoding read in .wav header");
+ lsx_report("User options overriding encoding read in .wav header");
break;
case WAVE_FORMAT_IMA_ADPCM:
@@ -536,7 +536,7 @@
if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN || ft->encoding.encoding == SOX_ENCODING_IMA_ADPCM)
ft->encoding.encoding = SOX_ENCODING_IMA_ADPCM;
else
- sox_report("User options overriding encoding read in .wav header");
+ lsx_report("User options overriding encoding read in .wav header");
break;
case WAVE_FORMAT_ADPCM:
@@ -543,7 +543,7 @@
if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN || ft->encoding.encoding == SOX_ENCODING_MS_ADPCM)
ft->encoding.encoding = SOX_ENCODING_MS_ADPCM;
else
- sox_report("User options overriding encoding read in .wav header");
+ lsx_report("User options overriding encoding read in .wav header");
break;
case WAVE_FORMAT_IEEE_FLOAT:
@@ -550,7 +550,7 @@
if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN || ft->encoding.encoding == SOX_ENCODING_FLOAT)
ft->encoding.encoding = SOX_ENCODING_FLOAT;
else
- sox_report("User options overriding encoding read in .wav header");
+ lsx_report("User options overriding encoding read in .wav header");
break;
case WAVE_FORMAT_ALAW:
@@ -557,7 +557,7 @@
if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN || ft->encoding.encoding == SOX_ENCODING_ALAW)
ft->encoding.encoding = SOX_ENCODING_ALAW;
else
- sox_report("User options overriding encoding read in .wav header");
+ lsx_report("User options overriding encoding read in .wav header");
break;
case WAVE_FORMAT_MULAW:
@@ -564,7 +564,7 @@
if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN || ft->encoding.encoding == SOX_ENCODING_ULAW)
ft->encoding.encoding = SOX_ENCODING_ULAW;
else
- sox_report("User options overriding encoding read in .wav header");
+ lsx_report("User options overriding encoding read in .wav header");
break;
case WAVE_FORMAT_OKI_ADPCM:
@@ -579,7 +579,7 @@
if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN || ft->encoding.encoding == SOX_ENCODING_GSM )
ft->encoding.encoding = SOX_ENCODING_GSM;
else
- sox_report("User options overriding encoding read in .wav header");
+ lsx_report("User options overriding encoding read in .wav header");
break;
case WAVE_FORMAT_ROCKWELL_ADPCM:
return wavfail(ft, "Rockwell ADPCM");
@@ -606,12 +606,12 @@
if (ft->signal.channels == 0 || ft->signal.channels == wChannels)
ft->signal.channels = wChannels;
else
- sox_report("User options overriding channels read in .wav header");
+ lsx_report("User options overriding channels read in .wav header");
if (ft->signal.rate == 0 || ft->signal.rate == dwSamplesPerSecond)
ft->signal.rate = dwSamplesPerSecond;
else
- sox_report("User options overriding rate read in .wav header");
+ lsx_report("User options overriding rate read in .wav header");
wav->lsx_ms_adpcm_i_coefs = NULL;
@@ -628,7 +628,7 @@
lsx_readw(ft, &wExtSize);
len -= 2;
} else {
- sox_warn("wave header missing FmtExt chunk");
+ lsx_warn("wave header missing FmtExt chunk");
}
}
@@ -690,7 +690,7 @@
if (i<14) errct += (wav->lsx_ms_adpcm_i_coefs[i] != lsx_ms_adpcm_i_coef[i/2][i%2]);
/* lsx_debug("lsx_ms_adpcm_i_coefs[%2d] %4d",i,wav->lsx_ms_adpcm_i_coefs[i]); */
}
- if (errct) sox_warn("base lsx_ms_adpcm_i_coefs differ in %d/14 positions",errct);
+ if (errct) lsx_warn("base lsx_ms_adpcm_i_coefs differ in %d/14 positions",errct);
}
bytespersample = 2; /* AFTER de-compression */
@@ -762,7 +762,7 @@
if (!ft->encoding.bits_per_sample || ft->encoding.bits_per_sample == wBitsPerSample)
ft->encoding.bits_per_sample = wBitsPerSample;
else
- sox_warn("User options overriding size read in .wav header");
+ lsx_warn("User options overriding size read in .wav header");
/* Now we have enough information to set default encodings. */
switch (bytespersample)
@@ -921,7 +921,7 @@
lsx_debug("Chunk ICRD");
if (len > 254)
{
- sox_warn("Possible buffer overflow hack attack (ICRD)!");
+ lsx_warn("Possible buffer overflow hack attack (ICRD)!");
break;
}
lsx_reads(ft,text, (size_t)len);
@@ -940,7 +940,7 @@
lsx_debug("Chunk ISFT");
if (len > 254)
{
- sox_warn("Possible buffer overflow hack attack (ISFT)!");
+ lsx_warn("Possible buffer overflow hack attack (ISFT)!");
break;
}
lsx_reads(ft,text, (size_t)len);
@@ -1059,7 +1059,7 @@
done = wavgsmread(ft, buf, len);
if (done == 0 && wav->numSamples != 0 && !wav->ignoreSize)
- sox_warn("Premature EOF on .wav input file");
+ lsx_warn("Premature EOF on .wav input file");
break;
default: /* assume PCM or float encoding */
@@ -1070,7 +1070,7 @@
/* If software thinks there are more samples but I/O */
/* says otherwise, let the user know about this. */
if (done == 0 && wav->numSamples != 0 && !wav->ignoreSize)
- sox_warn("Premature EOF on .wav input file");
+ lsx_warn("Premature EOF on .wav input file");
}
/* Only return buffers that contain a totally playable
@@ -1133,7 +1133,7 @@
wav->numSamples = 0;
wav->dataLength = 0;
if (!ft->signal.length && !ft->seekable)
- sox_warn("Length in output .wav header will be wrong since can't seek to fix it");
+ lsx_warn("Length in output .wav header will be wrong since can't seek to fix it");
rc = wavwritehdr(ft, 0); /* also calculates various wav->* info */
if (rc != 0)
@@ -1312,7 +1312,7 @@
case SOX_ENCODING_GSM:
if (wChannels!=1)
{
- sox_report("Overriding GSM audio from %d channel to 1",wChannels);
+ lsx_report("Overriding GSM audio from %d channel to 1",wChannels);
if (!second_header)
ft->signal.length /= max(1, ft->signal.channels);
wChannels = ft->signal.channels = 1;
@@ -1373,7 +1373,7 @@
if (ft->encoding.reverse_bytes == MACHINE_IS_LITTLEENDIAN)
{
if (!second_header)
- sox_report("Requested to swap bytes so writing RIFX header");
+ lsx_report("Requested to swap bytes so writing RIFX header");
lsx_writes(ft, "RIFX");
}
else
@@ -1448,7 +1448,7 @@
lsx_debug("GSM6.10 format: %li blocks %u padded samples %u padded data bytes",
blocksWritten, dwSamplesWritten, dwDataLength);
if (wav->gsmbytecount != dwDataLength)
- sox_warn("help ! internal inconsistency - data_written %u gsmbytecount %lu",
+ lsx_warn("help ! internal inconsistency - data_written %u gsmbytecount %lu",
dwDataLength, (unsigned long)wav->gsmbytecount);
}
--- a/src/wavpack.c
+++ b/src/wavpack.c
@@ -57,7 +57,7 @@
ft->encoding.bits_per_sample = WavpackGetBytesPerSample(p->codec) << 3;
ft->signal.channels = WavpackGetNumChannels(p->codec);
if (WavpackGetSampleRate(p->codec) && ft->signal.rate && ft->signal.rate != WavpackGetSampleRate(p->codec))
- sox_warn("`%s': overriding sample rate", ft->filename);
+ lsx_warn("`%s': overriding sample rate", ft->filename);
else ft->signal.rate = WavpackGetSampleRate(p->codec);
ft->signal.length = WavpackGetNumSamples(p->codec) * ft->signal.channels;
--- a/src/xa.c
+++ b/src/xa.c
@@ -128,19 +128,19 @@
if (!ft->encoding.bits_per_sample || ft->encoding.bits_per_sample == xa->header.bits) {
ft->encoding.bits_per_sample = xa->header.bits;
} else {
- sox_report("User options overriding size read in .xa header");
+ lsx_report("User options overriding size read in .xa header");
}
if (ft->signal.channels == 0 || ft->signal.channels == xa->header.channels) {
ft->signal.channels = xa->header.channels;
} else {
- sox_report("User options overriding channels read in .xa header");
+ lsx_report("User options overriding channels read in .xa header");
}
if (ft->signal.rate == 0 || ft->signal.rate == xa->header.sampleRate) {
ft->signal.rate = xa->header.sampleRate;
} else {
- sox_report("User options overriding rate read in .xa header");
+ lsx_report("User options overriding rate read in .xa header");
}
/* Check for supported formats */
@@ -152,17 +152,17 @@
/* Validate the header */
if (xa->header.bits != ft->encoding.bits_per_sample) {
- sox_report("Invalid sample resolution %d bits. Assuming %d bits.",
+ lsx_report("Invalid sample resolution %d bits. Assuming %d bits.",
xa->header.bits, ft->encoding.bits_per_sample);
xa->header.bits = ft->encoding.bits_per_sample;
}
if (xa->header.align != (ft->encoding.bits_per_sample >> 3) * xa->header.channels) {
- sox_report("Invalid sample alignment value %d. Assuming %d.",
+ lsx_report("Invalid sample alignment value %d. Assuming %d.",
xa->header.align, (ft->encoding.bits_per_sample >> 3) * xa->header.channels);
xa->header.align = (ft->encoding.bits_per_sample >> 3) * xa->header.channels;
}
if (xa->header.avgByteRate != (xa->header.align * xa->header.sampleRate)) {
- sox_report("Invalid dwAvgByteRate value %d. Assuming %d.",
+ lsx_report("Invalid dwAvgByteRate value %d. Assuming %d.",
xa->header.avgByteRate, xa->header.align * xa->header.sampleRate);
xa->header.avgByteRate = xa->header.align * xa->header.sampleRate;
}
--- a/src/xmalloc.c
+++ b/src/xmalloc.c
@@ -35,7 +35,7 @@
}
if ((ptr = realloc(ptr, newsize)) == NULL) {
- sox_fail("out of memory");
+ lsx_fail("out of memory");
exit(2);
}