aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sio.c18
-rw-r--r--sio.h2
-rw-r--r--spectrogram.c2
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 <stdlib.h>
#include <sndio.h>
+#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);