GBA Audio: Fix audio channels being silenced at the wrong time
Jeffrey Pfau jeffrey@endrift.com
Mon, 14 Sep 2015 19:25:48 -0700
2 files changed,
10 insertions(+),
5 deletions(-)
M
CHANGES
→
CHANGES
@@ -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: Window size command line options are now supported - Qt: Increase usability of key mapper
M
src/gba/audio.c
→
src/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 {