From a8655ac4cb70abe872361e3f2978d6edf591cfad Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Tue, 2 Jul 2013 15:28:32 +0000 Subject: move audio settings into module --- sio.c | 18 +++++++++++------- sio.h | 2 +- spectrogram.c | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/sio.c b/sio.c index 11c6db0..1758c40 100644 --- a/sio.c +++ b/sio.c @@ -19,6 +19,10 @@ #include #include +#define RCHAN 2 +#define BITS 16 +#define SIGNED 1 + struct sio { struct sio_hdl *sio; struct sio_par par; @@ -27,7 +31,7 @@ struct sio { }; struct sio * -init_sio(int rchan, int bits, int sig) +init_sio(void) { struct sio *sio; @@ -42,20 +46,20 @@ init_sio(int rchan, int bits, int sig) sio_initpar(&sio->par); - sio->par.rchan = rchan; - sio->par.bits = bits; + sio->par.rchan = RCHAN; + sio->par.bits = BITS; sio->par.le = SIO_LE_NATIVE; - sio->par.sig = sig; + sio->par.sig = SIGNED; if (!sio_setpar(sio->sio, &sio->par)) errx(1, "SIO set params failed"); if (!sio_getpar(sio->sio, &sio->par)) errx(1, "SIO get params failed"); - if (sio->par.rchan != rchan || - sio->par.bits != bits || + if (sio->par.rchan != RCHAN || + sio->par.bits != BITS || sio->par.le != SIO_LE_NATIVE || - sio->par.sig != sig) + sio->par.sig != SIGNED) errx(1, "unsupported audio params"); sio->bufsz = sio->par.rchan * sio->par.round * sizeof(int16_t); diff --git a/sio.h b/sio.h index 14ceaf6..40d7793 100644 --- a/sio.h +++ b/sio.h @@ -20,7 +20,7 @@ struct sio; -struct sio *init_sio(int, int, int); +struct sio *init_sio(void); unsigned int get_round(struct sio *); int16_t *read_sio(struct sio *); void del_sio(struct sio *); diff --git a/spectrogram.c b/spectrogram.c index 6717fd2..b93c943 100644 --- a/spectrogram.c +++ b/spectrogram.c @@ -363,7 +363,7 @@ main(int argc, char **argv) if (!dsp) errx(1, "Cannot connect to X11 server"); - sio = init_sio(2, 16, 1); + sio = init_sio(); if (dflag) daemon(0, 0); -- cgit v1.2.3