ref: dfe486f33e09b5996fc86c761eaa76db7e8b0b5b
parent: c38987e8d20505621b8d872863afa7d233ed1096
author: cbagwell <cbagwell>
date: Sun Dec 16 17:47:37 EST 2001
Inversed alaw/ulaw support. Doc updates. Removed pick and split.
--- a/INSTALL
+++ b/INSTALL
@@ -35,7 +35,7 @@
WIN95/NT Makefile.dos (Needs modifying for Visual C++)
OS/2 Makefile.gcc (using EMX GCC compiler)
-To using a canned Makefile, a few steps need to be completed. First up,
+To use a canned Makefile, a few steps need to be completed. First up,
you need to make a copy of stconfig.h.in and call it stconfig.h. Modify
this file to reflect your environment.
@@ -80,11 +80,8 @@
sox monkey.voc -r 12500 -s -w monkey.xxx
If monkey.xxx plays properly (it's a very short monkey screech),
-congratulations! SoX works. Now you should run the "tests.sh"
-shell script if your running under a UNIX variant to exercise
-various test scenarios. It should print nothing out. You can also
-run tests.bat under DOS for similar tests.
+congratulations! SoX works.
-After that, "tests.sh" and "testall.sh" ("tests.bat" and "testall.bat"
-for DOS) tests most of the implemented file handlers to make sure
-that some portability issue haven't popped up
+After that, running "tests.sh" and "testall.sh" ("tests.bat" and
+"testall.bat" for DOS) tests most of the implemented file handlers to
+make sure that some portability issue haven't popped up.
--- a/Makefile.dos
+++ b/Makefile.dos
@@ -23,8 +23,8 @@
compand.obj copy.obj dcshift.obj deemphas.obj earwax.o \
echo.obj echos.obj fade.obj filter.obj flanger.obj highp.obj \
highpass.obj lowp.obj lowpass.obj map.obj mask.obj phaser.obj \
- pick.obj pitch.obj pan.obj polyphase.obj rate.obj resample.obj \
- reverb.obj reverse.obj silence.obj speed.obj split.obj stat.obj \
+ pitch.obj pan.obj polyphase.obj rate.obj resample.obj \
+ reverb.obj reverse.obj silence.obj speed.obj stat.obj \
stretch.obj swap.obj synth.obj trim.obj vibro.obj vol.obj
LIBOBJS = $(FOBJ) $(EOBJ) handlers.obj misc.obj getopt.obj util.obj
--- a/Makefile.gcc
+++ b/Makefile.gcc
@@ -27,8 +27,8 @@
EOBJ = avg.o band.o bandpass.o breject.o btrworth.o chorus.o compand.o \
copy.o dcshift.o deemphas.o earwax.o echo.o echos.o fade.o \
filter.o flanger.o highp.o highpass.o lowp.o lowpass.o map.o \
- mask.o pan.o phaser.o pick.o pitch.o polyphas.o rate.o \
- resample.o reverb.o reverse.o silence.o speed.o split.o \
+ mask.o pan.o phaser.o pitch.o polyphas.o rate.o \
+ resample.o reverb.o reverse.o silence.o speed.o \
stat.o stretch.o swap.o synth.o trim.o vibro.o vol.o
SOUNDLIB = libst.a
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Sox: Sound eXchange
+SoX: Sound eXchange
-------------------
SoX (also known as Sound eXchange) translates sound files between different
@@ -21,7 +21,7 @@
o AVR files
o CD-R (music CD format)
o CVS and VMS files (continuous variable slope)
- o GSM files.
+ o GSM files
o Macintosh HCOM files
o Amiga MAUD files
o IRCAM SoundFile files
@@ -30,6 +30,7 @@
o Soundtool (DOS) files
o Yamaha TX-16W sampler files.
o Sound Blaster .VOC files
+ o Ogg Vorbis files
o Microsoft .WAV files
o PCM, u-law, A-law
o MS ADPCM, IMA ADPCM
@@ -41,11 +42,12 @@
The sound effects include:
- o Channel Averaging
+ o Channel averaging, duplication, and removal
o Band-pass filters
o Band-reject filter
o Chorus effect
o DCShift audio. Useful to get the best volume adjustments.
+ o Deemphases filter
o Move sound stage of CD audio to in front of you (for headphone use)
o Add an echo
o Add a sequence of echos
@@ -53,23 +55,21 @@
o Apply a flanger effect
o Apply a high-pass filter
o Apply a low-pass filter
- o Pan sound between channels
- o Change the pitch of a sound file
o Display a list of loops in a file
o Add masking noise to a signal
+ o Pan sound between channels
o Apply a phaser effect
- o Convert from stereo to mono
+ o Change the pitch of a sound file without effecting its speed
o Change sampling rates using several different algorithms. A
'resample' and 'polyphase' effect use high-grade signal rate
changes using real signal theory!
o Apply a reverb effect
o Reverse the sound samples (to search for Satanic messages ;-)
- o Trim off silence from the beginning of end of a file.
+ o Detect periods of silence and start and stop processing based on it
o Change the speed of samples being played (like speeding up the motor
on a tape recorder)
- o Convert from mono to stereo
o Display general stats on a sound sample
- o Stretch/shorten the duration of a sound file.
+ o Stretch/shorten the duration of a sound file (without effecting pitch).
o Swap stereo channels
o Create sounds with a simple synthesizer.
o Trim audio data from beginning and end of file.
@@ -104,7 +104,7 @@
image manipulation.
If you have bug fixes/enhancements, please send it to me as I would like
-to coordinate the releases. Please document your changes. I don't
+to coordinate the releases. Please document your changes. I do not
possess every kind of computer currently sold, and SoX is now beyond
the phase where I can understand and test most of your contributions.
--- a/pick.c
+++ /dev/null
@@ -1,146 +1,0 @@
-/*
- * July 5, 1991
- * Copyright 1991 Lance Norskog And Sundry Contributors
- * This source code is freely redistributable and may be used for
- * any purpose. This copyright notice must be maintained.
- * Lance Norskog And Sundry Contributors are not responsible for
- * the consequences of using this software.
- */
-
-/*
- * "pick" effect by Lauren Weinstein (lauren@vortex.com); 2/94
- * Creates a 1 channel file by selecting a single channel from
- * a 2 or 4 channel file. Does not currently allow creating a 2 channel
- * file by selecting 2 channels from a 4 channel file.
- */
-
-#include "st_i.h"
-
-/* Private data for SKEL file */
-typedef struct pickstuff {
- int chan; /* selected channel */
-} *pick_t;
-
-/* channel names are offset by 1 from actual channel byte array offsets */
-#define CHAN_1 0
-#define CHAN_2 1
-#define CHAN_3 2
-#define CHAN_4 3
-
-/*
- * Process options
- */
-int st_pick_getopts(eff_t effp, int n, char **argv)
-{
- pick_t pick = (pick_t) effp->priv;
-
- if (n == 1 && argv[0][0] == '-') { /* must specify channel to pick */
- switch (argv[0][1]) {
- case 'l':
- pick->chan = CHAN_1;
- return (ST_SUCCESS);
- case 'r':
- pick->chan = CHAN_2;
- return (ST_SUCCESS);
- case '1':
- pick->chan = CHAN_1;
- return (ST_SUCCESS);
- case '2':
- pick->chan = CHAN_2;
- return (ST_SUCCESS);
- case '3':
- pick->chan = CHAN_3;
- return (ST_SUCCESS);
- case '4':
- pick->chan = CHAN_4;
- return (ST_SUCCESS);
- }
- }
- /* Invalid option given. Will give error when st_pick_stat()
- * is called
- */
- pick->chan = -1;
- return (ST_SUCCESS);
-}
-
-
-/*
- * Start processing. Final option checking is done here since
- * error/usage messages will vary based on the number of input/output
- * channels selected, and that info is not available in pick_getopts()
- * above.
- */
-int st_pick_start(eff_t effp)
-{
- pick_t pick = (pick_t) effp->priv;
-
- if (effp->outinfo.channels != 1) /* must be one output channel */
- {
- st_fail("Pick effect requires output to be forced to 1 channel. Currenty it is set for %d channels.",effp->outinfo.channels);
- return (ST_EOF);
- }
- if (effp->ininfo.channels != 2 && effp->ininfo.channels != 4)
- {
- st_fail("Pick effect can not work with mono input data.");
- return (ST_EOF);
- }
- if (effp->ininfo.channels == 2) { /* check for valid option */
- if (pick->chan == -1 || pick->chan == CHAN_3 || pick->chan == CHAN_4)
- {
- st_fail("Must specify channel to pick: '-l', '-r', '-1', or '-2'.");
- return (ST_EOF);
- }
- }
- else /* must be 4 channels; check for valid option */
- if (pick->chan == -1)
- {
- st_fail("Must specify channel to pick: '-1', '-2', '-3', or '-4'.");
- return (ST_EOF);
- }
- return (ST_SUCCESS);
-}
-
-/*
- * Process signed long samples from ibuf to obuf,
- * isamp or osamp samples, whichever is smaller,
- * while picking appropriate channels.
- */
-int st_pick_flow(eff_t effp, st_sample_t *ibuf, st_sample_t *obuf,
- st_size_t *isamp, st_size_t *osamp)
-{
- pick_t pick = (pick_t) effp->priv;
- int len, done;
-
- switch (effp->ininfo.channels) {
- case 2:
- len = ((*isamp/2 > *osamp) ? *osamp : *isamp/2);
- for(done = 0; done < len; done++) {
- *obuf++ = ibuf[pick->chan];
- ibuf += 2;
- }
- *isamp = len * 2;
- *osamp = len;
- break;
- case 4:
- len = ((*isamp/4 > *osamp) ? *osamp : *isamp/4);
- for(done = 0; done < len; done++) {
- *obuf++ = ibuf[pick->chan];
- ibuf += 4;
- }
- *isamp = len * 4;
- *osamp = len;
- break;
- }
- return (ST_SUCCESS);
-}
-
-/*
- * Do anything required when you stop reading samples.
- * Don't close input file!
- */
-int st_pick_stop(eff_t effp)
-{
- /* nothing to do */
- return (ST_SUCCESS);
-}
-
--- a/sox.1
+++ b/sox.1
@@ -239,6 +239,13 @@
When uncompressed u-law has roughly the precision of 14-byte PCM audio
and A-law has roughly the precision of 13-bit PCM audio.
.br
+A-law and u-law data is sometimes encoded using a reversed bit-ordering
+(ie. MSB becomes LSB). Internally, SoX understands how to work with
+this encoding but there is currently no command line option to
+specify it. If you need this support then you can use the psuedo
+file types of ".la" and ".lu" to inform sox of the encoding. See
+supported file types for more information.
+.br
ADPCM is a form of sound compression that has a good
compromise between good sound quality and fast encoding/decoding
time. It is used for telephone sound compression and places were
@@ -265,8 +272,6 @@
be swapped according to the word-size given above.
Only 16-bit and 32-bit integer data may be swapped.
Machine-format floating-point data is not portable.
-This flag is also used to invert the bit ordering of u-law
-and A-law data (MSB becomes LSB).
.TP 10
\fB-c \fIchannels\fR
The number of sound channels in the data file.
--- a/sox.txt
+++ b/sox.txt
@@ -181,6 +181,15 @@
uncompressed u-law has roughly the precision of
14-byte PCM audio and A-law has roughly the pre�
cision of 13-bit PCM audio.
+ A-law and u-law data is sometimes encoded using
+ a reversed bit-ordering (ie. MSB becomes LSB).
+ Internally, SoX understands how to work with
+ this encoding but there is currently no command
+ line option to specify it. If you need this
+ support then you can use the psuedo file types
+ of ".la" and ".lu" to inform sox of the encod�
+ ing. See supported file types for more informa�
+ tion.
ADPCM is a form of sound compression that has a
good compromise between good sound quality and
fast encoding/decoding time. It is used for
@@ -209,9 +218,7 @@
order than yours and must be swapped according
to the word-size given above. Only 16-bit and
32-bit integer data may be swapped. Machine-
- format floating-point data is not portable.
- This flag is also used to invert the bit order�
- ing of u-law and A-law data (MSB becomes LSB).
+ format floating-point data is not portable.
-c channels
The number of sound channels in the data file.
@@ -320,11 +327,11 @@
.dat Text Data files
These files contain a textual representation of
the sample data. There is one line at the
- beginning that contains the sample rate. Subse�
- quent lines contain two numeric data items: the
- time since the beginning of the first sample and
- the sample value. Values are normalized so that
- the maximum and minimum are 1.00 and -1.00.
+ beginning that contains the sample rate.
+ Subsequent lines contain two numeric data items:
+ the time since the beginning of the first sample
+ and the sample value. Values are normalized so
+ that the maximum and minimum are 1.00 and -1.00.
This file format can be used to create data
files for external programs such as FFT analyz�
ers or graph routines. SoX can also convert a
@@ -452,9 +459,9 @@
.txw Yamaha TX-16W sampler.
A file format from a Yamaha sampling keyboard
- which wrote IBM-PC format 3.5" floppies. Han�
- dles reading of files which do not have the sam�
- ple rate field set to one of the expected by
+ which wrote IBM-PC format 3.5" floppies.
+ Handles reading of files which do not have the
+ sample rate field set to one of the expected by
looking at some other bytes in the attack/loop
length fields, and defaulting to 33kHz if the
sample rate is still unknown.
@@ -855,11 +862,11 @@
dow. Default is nut.
-width long / short / # : specify the (approxi�
- mate) width of the filter. long is 1024
- samples; short is 128 samples. Alternatively,
- an exact number can be used. Default is long.
- The short option is not recommended, as it pro�
- duces poor quality results.
+ mate) width of the filter. long is 1024 sam�
+ ples; short is 128 samples. Alternatively, an
+ exact number can be used. Default is long. The
+ short option is not recommended, as it produces
+ poor quality results.
-cutoff # : specify the filter cutoff frequency
in terms of fraction of frequency bandwidth,
--- a/split.c
+++ /dev/null
@@ -1,125 +1,0 @@
-
-/*
- * July 5, 1991
- * Copyright 1991 Lance Norskog And Sundry Contributors
- * This source code is freely redistributable and may be used for
- * any purpose. This copyright notice must be maintained.
- * Lance Norskog And Sundry Contributors are not responsible for
- * the consequences of using this software.
- */
-
-/*
- * "split" effect by Lauren Weinstein (lauren@vortex.com); 2/94
- * Splits 1 channel file to 2 channels (stereo), or 4 channels (quad);
- * or splits a 2 channel file to 4 channels.
- */
-
-#include <math.h>
-#include "st_i.h"
-
-/* Private data for split */
-typedef struct splitstuff {
- int rest; /* bytes remaining in current block */
-} *split_t;
-
-/*
- * Process options
- */
-int st_split_getopts(eff_t effp, int n, char **argv)
-{
- if (n)
- {
- st_fail("Split effect takes no options.");
- return (ST_EOF);
- }
- return (ST_SUCCESS);
-}
-
-/*
- * Prepare processing.
- */
-int st_split_start(eff_t effp)
-{
- switch (effp->ininfo.channels) {
- case 1: /* 1 channel must split to 2 or 4 */
- switch(effp->outinfo.channels) {
- case 2:
- case 4:
- return (ST_SUCCESS);
- }
- break;
- case 2: /* 2 channels must split to 4 */
- switch(effp->outinfo.channels) {
- case 4:
- return (ST_SUCCESS);
- }
- break;
- }
- st_fail("Can't split %d channels into %d channels",
- effp->ininfo.channels, effp->outinfo.channels);
- return (ST_EOF);
-}
-
-/*
- * Process signed long samples from ibuf to obuf,
- * isamp or osamp samples, whichever is smaller,
- * while splitting into appropriate channels.
- */
-int st_split_flow(eff_t effp, st_sample_t *ibuf, st_sample_t *obuf,
- st_size_t *isamp, st_size_t *osamp)
-{
- int len, done;
-
- switch(effp->ininfo.channels) {
- case 1: /* 1 input channel */
- switch(effp->outinfo.channels) {
- case 2: /* split to 2 channels */
- len = ((*isamp > *osamp/2)
- ? *osamp/2 : *isamp);
- for(done = 0; done < len; done++) {
- obuf[0] = obuf[1] = *ibuf++;
- obuf += 2;
- }
- *isamp = len;
- *osamp = len * 2;
- break;
- case 4: /* split to 4 channels */
- len = ((*isamp > *osamp/4)
- ? *osamp/4 : *isamp);
- for(done = 0; done < len; done++) {
- obuf[0] = obuf[1] = obuf[2]
- = obuf[3] = *ibuf++;
- obuf += 4;
- }
- *isamp = len;
- *osamp = len * 4;
- break;
- }
- break;
- case 2: /* 2 input channels; split to 4 channels */
- /* We're using the same channel ordering */
- /* as in "avg.c"--sure hope it's correct! */
- len = ((*isamp/2 > *osamp/4)
- ? *osamp/4 : *isamp/2);
- for(done = 0; done < len; done++) {
- obuf[0] = obuf[2] = ibuf[0];
- obuf[1] = obuf[3] = ibuf[1];
- ibuf += 2;
- obuf += 4;
- }
- *isamp = len;
- *osamp = len * 2;
- break;
- }
- return (ST_SUCCESS);
-}
-
-/*
- * Do anything required when you stop reading samples.
- * Don't close input file!
- */
-int st_split_stop(eff_t effp)
-{
- /* nothing to do */
- return (ST_SUCCESS);
-}
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -53,8 +53,8 @@
EOBJ = avg.o band.o bandpass.o breject.o btrworth.o chorus.o compand.o \
copy.o dcshift.o deemphas.o earwax.o echo.o echos.o \
fade.o filter.o flanger.o highp.o highpass.o lowp.o lowpass.o \
- map.o mask.o pan.o phaser.o pick.o pitch.o polyphas.o \
- rate.o resample.o reverb.o reverse.o silence.o speed.o split.o \
+ map.o mask.o pan.o phaser.o pitch.o polyphas.o \
+ rate.o resample.o reverb.o reverse.o silence.o speed.o \
stat.o stretch.o swap.o synth.o trim.o vibro.o vol.o
OSSOBJ_0 =
--- a/src/handlers.c
+++ b/src/handlers.c
@@ -444,9 +444,6 @@
{"phaser", 0,
st_phaser_getopts, st_phaser_start, st_phaser_flow,
st_phaser_drain, st_phaser_stop},
- {"pick", ST_EFF_MCHAN | ST_EFF_CHAN,
- st_pick_getopts, st_pick_start, st_pick_flow,
- st_effect_nothing_drain, st_pick_stop},
{"pitch", 0,
st_pitch_getopts, st_pitch_start, st_pitch_flow,
st_pitch_drain, st_pitch_stop},
@@ -471,9 +468,6 @@
{"speed", 0,
st_speed_getopts, st_speed_start,
st_speed_flow, st_speed_drain, st_speed_stop},
- {"split", ST_EFF_MCHAN | ST_EFF_CHAN,
- st_split_getopts, st_split_start, st_split_flow,
- st_effect_nothing_drain, st_split_stop},
{"stat", ST_EFF_MCHAN | ST_EFF_REPORT,
st_stat_getopts, st_stat_start, st_stat_flow,
st_stat_drain, st_stat_stop},
--- a/src/misc.c
+++ b/src/misc.c
@@ -40,7 +40,7 @@
"NONSENSE",
"NONSENSE",
"NONSENSE",
- "long longs",
+ "long longs"
};
const char *st_encodings_str[] = {
@@ -53,6 +53,8 @@
"adpcm",
"ima_adpcm",
"gsm",
+ "inversed u-law",
+ "inversed A-law"
};
static const char readerr[] = "Premature EOF while reading sample file.";
--- a/src/raw.c
+++ b/src/raw.c
@@ -161,65 +161,64 @@
void st_ulaw_read_buf(st_sample_t *buf1, char *buf2, st_ssize_t len,
char swap)
{
- if (swap)
+ while (len)
{
- while (len)
- {
- uint8_t datum;
+ uint8_t datum;
- datum = *((uint8_t *)buf2);
- buf2++;
+ datum = *((uint8_t *)buf2);
+ buf2++;
- *buf1++ = ST_INVERT_ULAW_BYTE_TO_SAMPLE(datum);
- len--;
- }
+ *buf1++ = ST_ULAW_BYTE_TO_SAMPLE(datum);
+ len--;
}
- else
+}
+
+void st_alaw_read_buf(st_sample_t *buf1, char *buf2, st_ssize_t len,
+ char swap)
+{
+ while (len)
{
- while (len)
- {
- uint8_t datum;
+ uint8_t datum;
- datum = *((uint8_t *)buf2);
- buf2++;
+ datum = *((uint8_t *)buf2);
+ buf2++;
- *buf1++ = ST_ULAW_BYTE_TO_SAMPLE(datum);
- len--;
- }
+ *buf1++ = ST_ALAW_BYTE_TO_SAMPLE(datum);
+ len--;
}
}
-void st_alaw_read_buf(st_sample_t *buf1, char *buf2, st_ssize_t len,
- char swap)
+void st_inv_ulaw_read_buf(st_sample_t *buf1, char *buf2, st_ssize_t len,
+ char swap)
{
- if (swap)
+ while (len)
{
- while (len)
- {
- uint8_t datum;
+ uint8_t datum;
- datum = *((uint8_t *)buf2);
- buf2++;
+ datum = *((uint8_t *)buf2);
+ buf2++;
- *buf1++ = ST_INVERT_ALAW_BYTE_TO_SAMPLE(datum);
- len--;
- }
+ *buf1++ = ST_INVERT_ULAW_BYTE_TO_SAMPLE(datum);
+ len--;
}
- else
+}
+
+void st_inv_alaw_read_buf(st_sample_t *buf1, char *buf2, st_ssize_t len,
+ char swap)
+{
+ while (len)
{
- while (len)
- {
- uint8_t datum;
+ uint8_t datum;
- datum = *((uint8_t *)buf2);
- buf2++;
+ datum = *((uint8_t *)buf2);
+ buf2++;
- *buf1++ = ST_ALAW_BYTE_TO_SAMPLE(datum);
- len--;
- }
+ *buf1++ = ST_INVERT_ALAW_BYTE_TO_SAMPLE(datum);
+ len--;
}
}
+
void st_uw_read_buf(st_sample_t *buf1, char *buf2, st_ssize_t len, char swap)
{
while (len)
@@ -347,6 +346,12 @@
case ST_ENCODING_ALAW:
read_buf = st_alaw_read_buf;
break;
+ case ST_ENCODING_INV_ULAW:
+ read_buf = st_inv_ulaw_read_buf;
+ break;
+ case ST_ENCODING_INV_ALAW:
+ read_buf = st_inv_alaw_read_buf;
+ break;
default:
st_fail_errno(ft,ST_EFMT,"Do not support this encoding for this data size");
return(0);
@@ -476,45 +481,43 @@
void st_ulaw_write_buf(char *buf1, st_sample_t *buf2, st_ssize_t len,
char swap)
{
- if (swap)
+ while (len)
{
- while (len)
- {
- *(uint8_t *)buf1++ = ST_SAMPLE_TO_INVERT_ULAW_BYTE(*buf2++);
- len--;
- }
+ *(uint8_t *)buf1++ = ST_SAMPLE_TO_ULAW_BYTE(*buf2++);
+ len--;
}
- else
- {
- while (len)
- {
- *(uint8_t *)buf1++ = ST_SAMPLE_TO_ULAW_BYTE(*buf2++);
- len--;
- }
- }
}
void st_alaw_write_buf(char *buf1, st_sample_t *buf2, st_ssize_t len,
char swap)
{
- if (swap)
+ while (len)
{
- while (len)
- {
- *(uint8_t *)buf1++ = ST_SAMPLE_TO_INVERT_ALAW_BYTE(*buf2++);
- len--;
- }
+ *(uint8_t *)buf1++ = ST_SAMPLE_TO_ALAW_BYTE(*buf2++);
+ len--;
}
- else
+}
+
+void st_inv_ulaw_write_buf(char *buf1, st_sample_t *buf2, st_ssize_t len,
+ char swap)
+{
+ while (len)
{
- while (len)
- {
- *(uint8_t *)buf1++ = ST_SAMPLE_TO_ALAW_BYTE(*buf2++);
- len--;
- }
+ *(uint8_t *)buf1++ = ST_SAMPLE_TO_INVERT_ULAW_BYTE(*buf2++);
+ len--;
}
}
+void st_inv_alaw_write_buf(char *buf1, st_sample_t *buf2, st_ssize_t len,
+ char swap)
+{
+ while (len)
+ {
+ *(uint8_t *)buf1++ = ST_SAMPLE_TO_INVERT_ALAW_BYTE(*buf2++);
+ len--;
+ }
+}
+
void st_uw_write_buf(char *buf1, st_sample_t *buf2, st_ssize_t len, char swap)
{
while (len)
@@ -651,6 +654,12 @@
case ST_ENCODING_ALAW:
write_buf = st_alaw_write_buf;
break;
+ case ST_ENCODING_INV_ULAW:
+ write_buf = st_inv_ulaw_write_buf;
+ break;
+ case ST_ENCODING_INV_ALAW:
+ write_buf = st_inv_alaw_write_buf;
+ break;
default:
st_fail_errno(ft,ST_EFMT,"Do not support this encoding for this data size");
return(0);
@@ -775,41 +784,11 @@
STARTREAD(st_alstartread,ST_SIZE_BYTE,ST_ENCODING_ALAW)
STARTWRITE(st_alstartwrite,ST_SIZE_BYTE,ST_ENCODING_ALAW)
-int st_lustartread(ft_t ft)
-{
- ft->info.size = ST_SIZE_BYTE;
- ft->info.encoding = ST_ENCODING_ALAW;
- ft->swap = ft->swap ? 0 : 1;
- rawdefaults(ft);
- return st_rawstartread(ft);
-}
+STARTREAD(st_lustartread,ST_SIZE_BYTE,ST_ENCODING_INV_ULAW)
+STARTWRITE(st_lustartwrite,ST_SIZE_BYTE,ST_ENCODING_INV_ULAW)
-int st_lastartread(ft_t ft)
-{
- ft->info.size = ST_SIZE_BYTE;
- ft->info.encoding = ST_ENCODING_ALAW;
- ft->swap = ft->swap ? 0 : 1;
- rawdefaults(ft);
- return st_rawstartread(ft);
-}
-
-int st_lustartwrite(ft_t ft)
-{
- ft->info.size = ST_SIZE_BYTE;
- ft->info.encoding = ST_ENCODING_ALAW;
- ft->swap = ft->swap ? 0 : 1;
- rawdefaults(ft);
- return st_rawstartwrite(ft);
-}
-
-int st_lastartwrite(ft_t ft)
-{
- ft->info.size = ST_SIZE_BYTE;
- ft->info.encoding = ST_ENCODING_ALAW;
- ft->swap = ft->swap ? 0 : 1;
- rawdefaults(ft);
- return st_rawstartwrite(ft);
-}
+STARTREAD(st_lastartread,ST_SIZE_BYTE,ST_ENCODING_INV_ALAW)
+STARTWRITE(st_lastartwrite,ST_SIZE_BYTE,ST_ENCODING_INV_ALAW)
void rawdefaults(ft_t ft)
{
--- a/src/st.h
+++ b/src/st.h
@@ -184,13 +184,15 @@
/* Style field */
#define ST_ENCODING_UNSIGNED 1 /* unsigned linear: Sound Blaster */
#define ST_ENCODING_SIGN2 2 /* signed linear 2's comp: Mac */
-#define ST_ENCODING_ULAW 3 /* U-law signed logs: US telephony, SPARC */
+#define ST_ENCODING_ULAW 3 /* u-law signed logs: US telephony, SPARC */
#define ST_ENCODING_ALAW 4 /* A-law signed logs: non-US telephony */
#define ST_ENCODING_FLOAT 5 /* 32-bit float */
#define ST_ENCODING_ADPCM 6 /* Compressed PCM */
#define ST_ENCODING_IMA_ADPCM 7 /* Compressed PCM */
#define ST_ENCODING_GSM 8 /* GSM 6.10 33byte frame lossy compression */
-#define ST_ENCODING_MAX 8
+#define ST_ENCODING_INV_ULAW 9 /* Inversed bit-order u-law */
+#define ST_ENCODING_INV_ALAW 10/* Inversed bit-order A-law */
+#define ST_ENCODING_MAX 10
/* declared in misc.c */
extern const char *st_sizes_str[];
--- a/src/st_i.h
+++ b/src/st_i.h
@@ -474,12 +474,6 @@
int st_phaser_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp);
int st_phaser_stop(eff_t effp);
-int st_pick_getopts(eff_t effp, int argc, char **argv);
-int st_pick_start(eff_t effp);
-int st_pick_flow(eff_t effp, st_sample_t *ibuf, st_sample_t *obuf,
- st_size_t *isamp, st_size_t *osamp);
-int st_pick_stop(eff_t effp);
-
int st_pitch_getopts(eff_t effp, int argc, char **argv);
int st_pitch_start(eff_t effp);
int st_pitch_flow(eff_t effp, st_sample_t *ibuf, st_sample_t *obuf,
@@ -534,12 +528,6 @@
st_size_t *isamp, st_size_t *osamp);
int st_speed_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp);
int st_speed_stop(eff_t effp);
-
-int st_split_getopts(eff_t effp, int argc, char **argv);
-int st_split_start(eff_t effp);
-int st_split_flow(eff_t effp, st_sample_t *ibuf, st_sample_t *obuf,
- st_size_t *isamp, st_size_t *osamp);
-int st_split_stop(eff_t effp);
int st_stat_getopts(eff_t effp, int argc, char **argv);
int st_stat_start(eff_t effp);