ncmixer

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

commit 134e02da998c064d90bf0de4b0151d9850607c6c
parent 5e0ef3147f9f69fb1679e52758236409d90d98e3
Author: sin <sin@2f30.org>
Date:   Fri,  3 Jun 2016 11:40:49 +0100

Rename some variables in preparation to setting up the monitor output

Diffstat:
Mncmixer.c | 19++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/ncmixer.c b/ncmixer.c @@ -63,9 +63,9 @@ unsigned ch0_nsamples; /* input pcm data on channel 1 */ unsigned short ch1_buf[NSAMPLES]; unsigned ch1_nsamples; -/* output pcm data */ -unsigned short out_buf[NSAMPLES]; -unsigned out_nsamples; +/* master pcm data */ +unsigned short master_buf[NSAMPLES]; +unsigned master_nsamples; struct sio_hdl * audio_open(char *dev) @@ -242,15 +242,16 @@ mix(void) { short *ch0 = (short *)ch0_buf; short *ch1 = (short *)ch1_buf; - short *out = (short *)out_buf; + short *out = (short *)master_buf; int i; - memset(out_buf, 0, sizeof(out_buf)); - out_nsamples = MAX(ch0_nsamples, ch1_nsamples); - for (i = 0; i < out_nsamples; i++) { + memset(master_buf, 0, sizeof(master_buf)); + master_nsamples = MAX(ch0_nsamples, ch1_nsamples); + for (i = 0; i < master_nsamples; i++) { *out = *ch0 * 0.707 + *ch1 * 0.707; ch0++, ch1++, out++; } + /* XXX: mix monitor buffer as well */ } int @@ -396,8 +397,8 @@ loop(void) if (sio_hdl_master == NULL) { sio_hdl_master = audio_open(MASTER_DEV); if (sio_hdl_master != NULL && - audio_play(sio_hdl_master, out_buf, - out_nsamples * 2) == -1) + audio_play(sio_hdl_master, master_buf, + master_nsamples * 2) == -1) audio_close(&sio_hdl_master); } draw();