ncmixer

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

commit 17b650814fa24c2cac6919b4398beebe61df748b
parent 9799fa01fb5625e5e8f5866453441fa9fd488fcf
Author: sin <sin@2f30.org>
Date:   Fri,  3 Jun 2016 18:50:25 +0100

No need for conditionals in mix_monitor()

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

diff --git a/ncmixer.c b/ncmixer.c @@ -271,15 +271,15 @@ attenuate(struct input *in, float factor) } int -mix_master(struct output *out, struct input *in1, struct input *in2) +mix_master(struct output *out, struct input *in0, struct input *in1) { - short *ch0 = (short *)in1->attenuated_buf; - short *ch1 = (short *)in2->attenuated_buf; + short *ch0 = (short *)in0->attenuated_buf; + short *ch1 = (short *)in1->attenuated_buf; short *buf = (short *)out->buf; int i; memset(out->buf, 0, sizeof(out->buf)); - out->nsamples = MAX(in1->nsamples, in2->nsamples); + out->nsamples = MAX(in0->nsamples, in1->nsamples); for (i = 0; i < out->nsamples; i++) { *buf = *ch0 * 0.707 + *ch1 * 0.707; ch0++, ch1++, buf++; @@ -288,20 +288,18 @@ mix_master(struct output *out, struct input *in1, struct input *in2) } int -mix_monitor(struct output *out, struct input *in1, struct input *in2) +mix_monitor(struct output *out, struct input *in0, struct input *in1) { - short *ch0 = (short *)in1->buf; - short *ch1 = (short *)in2->buf; + short *ch0 = (short *)in0->buf; + short *ch1 = (short *)in1->buf; short *buf = (short *)out->buf; int i; memset(out->buf, 0, sizeof(out->buf)); - out->nsamples = MAX(in1->nsamples, in2->nsamples); + out->nsamples = MAX(in0->nsamples, in1->nsamples); for (i = 0; i < out->nsamples; i++) { - if (in1->monitor == 0) - *ch0 = 0; - if (in2->monitor == 0) - *ch1 = 0; + *ch0 *= in0->monitor; + *ch1 *= in1->monitor; *buf = *ch0 * 0.707 + *ch1 * 0.707; ch0++, ch1++, buf++; }