sad

simple audio daemon
git clone git://git.2f30.org/sad.git
Log | Files | Refs | LICENSE

commit d406e34110bf337aba555b90cf6f2af701d71c16
parent ce9d7494ccb1fc0d8fc403a4d135e6f70e22cad8
Author: sin <sin@2f30.org>
Date:   Sat Dec 27 12:51:43 +0000

Add setinputfmt() - will be needed later for SRC

Diffstat:
mp3.c | 1+
output.c | 12++++++++++++
sad.h | 1+
vorbis.c | 2++
wav.c | 2++
5 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/mp3.c b/mp3.c @@ -44,6 +44,7 @@ mp3open(const char *name) goto err0; } + setinputfmt(mpg123_encsize(encoding) * 8, rate, channels); return 0; err0: mpg123_close(hdl); diff --git a/output.c b/output.c @@ -19,6 +19,10 @@ static struct { { "sndio", 16, 44100, 2, 1, &sndiooutput }, }; +static int inbits; +static long inrate; +static int inchannels; + int openoutput(const char *name) { @@ -99,3 +103,11 @@ voloutput(int vol) } return r; } + +void +setinputfmt(int bits, long rate, int channels) +{ + inbits = bits; + inrate = rate; + inchannels = channels; +} diff --git a/sad.h b/sad.h @@ -96,3 +96,4 @@ int closeoutput(const char *); int closeoutputs(void); int playoutput(void *, size_t); int voloutput(int); +void setinputfmt(int, long, int); diff --git a/vorbis.c b/vorbis.c @@ -35,6 +35,8 @@ vorbisopen(const char *name) goto err0; } + setinputfmt(16, vi->rate, vi->channels); + return 0; err0: diff --git a/wav.c b/wav.c @@ -51,6 +51,8 @@ wavopen(const char *name) goto err0; } + setinputfmt(bits, sfinfo.samplerate, sfinfo.channels); + return 0; err0: sf_close(sf);