summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXANTRONIX Development2022-02-28 15:52:59 -0500
committerXANTRONIX Development2022-02-28 15:52:59 -0500
commiteb37f82dee0722a8295c42b1c11908ff67db45c2 (patch)
tree3dd7fa5809b2dc5d8bb893b266044cd561a49ec9 /src
parentdce70ad2853d45489c3fdb0c1dd90cb0fbb58f4d (diff)
downloadxas-eb37f82dee0722a8295c42b1c11908ff67db45c2.tar.gz
xas-eb37f82dee0722a8295c42b1c11908ff67db45c2.tar.bz2
xas-eb37f82dee0722a8295c42b1c11908ff67db45c2.zip
Fix bugs applying gain to voice output
Diffstat (limited to 'src')
-rw-r--r--src/vox.c10
1 files 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;