GBA Audio: Fix integer overflow sampling of channel 3
Jeffrey Pfau jeffrey@endrift.com
Sun, 23 Nov 2014 00:23:37 -0800
1 files changed,
3 insertions(+),
3 deletions(-)
jump to
M
src/gba/gba-audio.c
→
src/gba/gba-audio.c
@@ -655,9 +655,9 @@ ch->wavedata[i] = ((ch->wavedata[i] & 0xF0F0F0F0) >> 4) | ((ch->wavedata[i] & 0x000F0F0F) << 12);
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); }