ncmixer

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

commit ccc98a70449feecc312fbb3011eb5815fd11567e
parent eb47b2c1330bf24097735efd5c3a76add4c614f0
Author: sin <sin@2f30.org>
Date:   Mon,  6 Jun 2016 17:48:18 +0100

Don't play anything unless data was received on at least one of the inputs

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

diff --git a/ncmixer.c b/ncmixer.c @@ -367,7 +367,7 @@ loop(void) struct pollfd pfd[16]; struct input *in; struct output *out; - int i, ret, clifd, nready; + int i, ret, clifd, nready, gotdata; for (i = 0; i < LEN(pfd); i++) { pfd[i].fd = -1; @@ -427,6 +427,7 @@ loop(void) } /* read pcm data from sockets */ + gotdata = 0; for (i = 0; i < LEN(inputs); i++) { in = &inputs[i]; if (in->clifd == -1) @@ -438,12 +439,14 @@ loop(void) pfd[in->clifd].events = 0; close(in->clifd); in->clifd = -1; + } else { + gotdata = 1; } } } /* play dat shit! */ - for (i = 0; i < LEN(outputs); i++) { + for (i = 0; gotdata != 0 && i < LEN(outputs); i++) { out = &outputs[i]; /* open output device on demand */ if (out->sio_hdl == NULL) {