all repos — mgba @ 1a1fc95f17919e4f587668b16f5cc7be141acca0

mGBA Game Boy Advance Emulator

GBA Audio: Fix audio channels being silenced at the wrong time
Jeffrey Pfau jeffrey@endrift.com
Mon, 14 Sep 2015 19:25:48 -0700
commit

1a1fc95f17919e4f587668b16f5cc7be141acca0

parent

73b157205ae6a19da7cea9903dff744115547108

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

jump to
M CHANGESCHANGES

@@ -9,6 +9,7 @@ - GBA: Deinit savegame when unloading a ROM

- GBA: Fix BIOS check on big endian - Libretro: Fix a memory leak with the render buffer - GBA Audio: Fix 8-bit writes to audio channel 3 and 4 registers + - GBA Audio: Fix audio channels being silenced at the wrong time Misc: - Qt: Remove useless help icons in dialogs - GBA: Attempting to save a screenshot-style savestate should be allowed without libpng
M src/gba/audio.csrc/gba/audio.c

@@ -345,12 +345,10 @@ if (!audio->playingCh1) {

audio->nextCh1 = 0; } audio->playingCh1 = 1; - if (audio->ch1.envelope.stepTime) { - audio->ch1.envelope.nextStep = 0; - } else { - audio->ch1.envelope.nextStep = INT_MAX; - } audio->ch1.envelope.currentVolume = audio->ch1.envelope.initialVolume; + if (audio->ch1.envelope.currentVolume > 0) { + audio->ch1.envelope.dead = 0; + } if (audio->ch1.envelope.stepTime) { audio->ch1.envelope.nextStep = 0; } else {

@@ -372,6 +370,9 @@ audio->ch2.control.endTime = (GBA_ARM7TDMI_FREQUENCY * (64 - audio->ch2.envelope.length)) >> 8;

if (GBAAudioRegisterControlIsRestart(value)) { audio->playingCh2 = 1; audio->ch2.envelope.currentVolume = audio->ch2.envelope.initialVolume; + if (audio->ch2.envelope.currentVolume > 0) { + audio->ch2.envelope.dead = 0; + } if (audio->ch2.envelope.stepTime) { audio->ch2.envelope.nextStep = 0; } else {

@@ -419,6 +420,9 @@ audio->ch4.control.endTime = (GBA_ARM7TDMI_FREQUENCY * (64 - audio->ch4.envelope.length)) >> 8;

if (GBAAudioRegisterCh4ControlIsRestart(value)) { audio->playingCh4 = 1; audio->ch4.envelope.currentVolume = audio->ch4.envelope.initialVolume; + if (audio->ch4.envelope.currentVolume > 0) { + audio->ch4.envelope.dead = 0; + } if (audio->ch4.envelope.stepTime) { audio->ch4.envelope.nextStep = 0; } else {