ncmixer

ncurses audio mixer for DJ'ing
git clone git://git.2f30.org/ncmixer
Log | Files | Refs | README | LICENSE

commit effb6fb862c6e08bac7b76ea431750d0130bc640
parent 46aea8edbcdcc325650f8bd2ece59be9d37d6919
Author: sin <sin@2f30.org>
Date:   Sat, 11 Jun 2016 13:22:25 +0100

Don't hard-code assumption about bytes per channel

Diffstat:
Mncmixer.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ncmixer.c b/ncmixer.c @@ -30,6 +30,7 @@ #define MASTER_DEV "rsnd/0" /* bypass sndiod by default */ #define MONITOR_DEV "rsnd/1" #define BITS 16 +#define BPS (BITS / 8) #define RATE 44100 #define CHANS 2 #define NSAMPLES 2048 @@ -235,7 +236,7 @@ consume(struct input *in) } while (n == -1 && errno == EINTR); if (n == 0 || n == -1) return -1; - in->nsamples = n / 2; + in->nsamples = n / BPS; return in->nsamples; } @@ -538,7 +539,7 @@ loop(void) } out->mix(out, &inputs[0], &inputs[1]); ret = audio_play(out->sio_hdl, out->buf, - out->nsamples * 2); + out->nsamples * BPS); if (ret == -1) audio_close(&out->sio_hdl); }