all repos — mgba @ 8a0c5b9a1fe04eb027fc8a1d5120044885834d59

mGBA Game Boy Advance Emulator

GBA Audio: Fix sample order in audio channel 3
Jeffrey Pfau jeffrey@endrift.com
Mon, 29 Jun 2015 01:08:14 -0700
commit

8a0c5b9a1fe04eb027fc8a1d5120044885834d59

parent

841a0909b94716aab68acc8d08e00fd863cc2631

2 files changed, 6 insertions(+), 5 deletions(-)

jump to
M CHANGESCHANGES

@@ -50,6 +50,7 @@ - VFS: Fix line-reading to return proper values

- GBA Memory: Fix load/store multiple video memory waitstates - GBA: Fix timing of reading from timer registers - Util: Allow loading IPS patches that grow the ROM + - GBA Audio: Fix sample order in audio channel 3 Misc: - Qt: Handle saving input settings better - Debugger: Free watchpoints in addition to breakpoints
M src/gba/audio.csrc/gba/audio.c

@@ -704,15 +704,15 @@ } else {

start = 3; end = 0; } - uint32_t bitsCarry = ch->wavedata[end] & 0x0F000000; + uint32_t bitsCarry = ch->wavedata[end] & 0x000000F0; uint32_t bits; for (i = start; i >= end; --i) { - bits = ch->wavedata[i] & 0x0F000000; - ch->wavedata[i] = ((ch->wavedata[i] & 0xF0F0F0F0) >> 4) | ((ch->wavedata[i] & 0x000F0F0F) << 12); - ch->wavedata[i] |= bitsCarry >> 20; + bits = ch->wavedata[i] & 0x000000F0; + ch->wavedata[i] = ((ch->wavedata[i] & 0x0F0F0F0F) << 4) | ((ch->wavedata[i] & 0xF0F0F000) >> 12); + ch->wavedata[i] |= bitsCarry << 20; bitsCarry = bits; } - ch->sample = bitsCarry >> 24; + ch->sample = bitsCarry >> 4; ch->sample -= 8; ch->sample *= volume * 4; return 8 * (2048 - ch->control.rate);