Made Audio*/output return a minimum of 1 on a playing non-muted channel

This commit is contained in:
Andrew Alderwick 2021-08-20 22:43:35 +01:00
parent e4416264e8
commit ad4ff82138
1 changed files with 3 additions and 2 deletions

View File

@ -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];