From: Jérémie Astor Date: Wed, 7 Jul 2021 00:30:20 +0000 (+0200) Subject: :bug: Fix dac and adc output X-Git-Tag: nightly~551 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=134c75166753e529eab95e2490d5addc658bb091;p=gwion.git :bug: Fix dac and adc output --- diff --git a/src/lib/ugen.c b/src/lib/ugen.c index 51a42fc9..94aafb72 100644 --- a/src/lib/ugen.c +++ b/src/lib/ugen.c @@ -16,15 +16,20 @@ static TICK(dac_tick) { m_float *out = ((VM *)u->module.gen.data)->bbq->out; uint i = 0; - do out[i] = UGEN(u->connect.multi->channel[i])->in; - while (++i < u->connect.multi->n_out); + m_float sum = 0; + do { + sum += out[i] = UGEN(u->connect.multi->channel[i])->in; + } while (++i < u->connect.multi->n_out); + u->out = sum / u->connect.multi->n_out; } static TICK(adc_tick) { const m_float *in = ((VM *)u->module.gen.data)->bbq->in; uint i = 0; - do UGEN(u->connect.multi->channel[i])->out = in[i]; + m_float sum = 0; + do sum += UGEN(u->connect.multi->channel[i])->out = in[i]; while (++i < u->connect.multi->n_out); + u->out = sum / u->connect.multi->n_out; } #define COMPUTE(a) \