From 01849565aa17857c040d2b786b33756fd00b36b0 Mon Sep 17 00:00:00 2001 From: Ziemas Date: Sat, 20 Jan 2024 09:34:06 +0100 Subject: [PATCH] SPU: VolumeSlide: disregard phase when exp + decr --- pcsx2/SPU2/ADSR.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/pcsx2/SPU2/ADSR.cpp b/pcsx2/SPU2/ADSR.cpp index ef8808e95e..f679afb381 100644 --- a/pcsx2/SPU2/ADSR.cpp +++ b/pcsx2/SPU2/ADSR.cpp @@ -144,11 +144,20 @@ void V_VolumeSlide::Update() } } - counter_inc = std::max(1, counter_inc); + // Allow counter_inc to be zero only in when all bits + // of the rate field are set + if (Step != 3 && Shift != 0x1f) + { + counter_inc = std::max(1, counter_inc); + } Counter += counter_inc; // If negative phase "increase" to -0x8000 or "decrease" towards 0 - level_inc = Phase ? -level_inc : level_inc; + // Unless in Exp + Decr modes + if (!(Exp && Decr)) + { + level_inc = Phase ? -level_inc : level_inc; + } if (Counter >= 0x8000) { @@ -162,6 +171,11 @@ void V_VolumeSlide::Update() { s32 low = Phase ? INT16_MIN : 0; s32 high = Phase ? 0 : INT16_MAX; + if (Exp) + { + low = 0; + high = INT16_MAX; + } Value = std::clamp(Value + level_inc, low, high); } }