From ad4ff821384dec0976300610071020a2b0889368 Mon Sep 17 00:00:00 2001 From: Andrew Alderwick Date: Fri, 20 Aug 2021 22:43:35 +0100 Subject: [PATCH] Made Audio*/output return a minimum of 1 on a playing non-muted channel --- src/devices/apu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/devices/apu.c b/src/devices/apu.c index c3034dc..58b5c44 100644 --- a/src/devices/apu.c +++ b/src/devices/apu.c @@ -85,10 +85,11 @@ Uint8 apu_get_vu(Apu *c) { int i; - Sint32 sum[2]; + Sint32 sum[2] = {0, 0}; if(!c->advance || !c->period) return 0; for(i = 0; i < 2; ++i) { - sum[i] = envelope(c, c->age) * c->volume[i] / 0x800; + if(!c->volume[i]) continue; + sum[i] = 1 + envelope(c, c->age) * c->volume[i] / 0x800; if(sum[i] > 0xf) sum[i] = 0xf; } return (sum[0] << 4) | sum[1];