GBA Audio: Fix integer overflow sampling of channel 3

This commit is contained in:
Jeffrey Pfau 2014-11-23 00:23:37 -08:00
parent ebe543e482
commit 5a0e4e7a2d
1 changed files with 3 additions and 3 deletions

View File

@ -655,9 +655,9 @@ static int32_t _updateChannel3(struct GBAAudioChannel3* ch) {
ch->wavedata[i] |= bitsCarry >> 20;
bitsCarry = bits;
}
ch->sample = (bitsCarry >> 20);
ch->sample >>= 2;
ch->sample *= volume;
ch->sample = bitsCarry >> 24;
ch->sample -= 8;
ch->sample *= volume * 4;
return 8 * (2048 - ch->control.rate);
}