From 1b618b8c46407ba20ae55c633786fe0651584960 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 24 Oct 2020 20:26:35 +1000 Subject: [PATCH] SPU: Don't block ADPCM loop flag when setting/keying on in same slice Fixes repeated sounds in Re-Loaded: The Hardcore Sequel. --- src/core/spu.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/spu.cpp b/src/core/spu.cpp index 8411d3fa8..658422031 100644 --- a/src/core/spu.cpp +++ b/src/core/spu.cpp @@ -581,10 +581,11 @@ void SPU::WriteVoiceRegister(u32 offset, u16 value) // per-voice registers const u32 reg_index = (offset % 0x10); const u32 voice_index = (offset / 0x10); - Assert(voice_index < 24); + DebugAssert(voice_index < 24); Voice& voice = m_voices[voice_index]; - if (voice.IsOn() || m_key_on_register & (1u << voice_index)) + const bool voice_was_on = voice.IsOn(); + if (voice_was_on || m_key_on_register & (1u << voice_index)) m_tick_event->InvokeEarly(); switch (reg_index) @@ -648,7 +649,7 @@ void SPU::WriteVoiceRegister(u32 offset, u16 value) { Log_DebugPrintf("SPU voice %u ADPCM repeat address <- 0x%04X", voice_index, value); voice.regs.adpcm_repeat_address = value; - voice.ignore_loop_address = true; + voice.ignore_loop_address = voice_was_on; } break;