summaryrefslogtreecommitdiffstats
path: root/src/vox.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vox.c')
-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;