From eb37f82dee0722a8295c42b1c11908ff67db45c2 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Mon, 28 Feb 2022 15:52:59 -0500 Subject: Fix bugs applying gain to voice output --- src/vox.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/vox.c b/src/vox.c index 03ef796..84e2c28 100644 --- a/src/vox.c +++ b/src/vox.c @@ -213,16 +213,18 @@ static ssize_t vox_fill(xas_vox *vox, if (readlen == 0) { vox_stop(vox); - } else if (vox->gain != 1.0f) { + } + + readcount = readlen / vox->format.sample_size; + + if (readcount > 0 && vox->gain != 1.0f) { xas_audio_apply_gain(vox->format, samples, vox->gain, 0, - readlen); + readcount); } - readcount = readlen / vox->format.sample_size; - xas_audio_zero(vox->format, samples, readcount, count-readcount); return count; -- cgit v1.2.3