From 4fe1217a6908546fc411bcf85b42e87b68cf939e Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Tue, 18 Oct 2022 16:47:43 +0100 Subject: [PATCH] SPU: Clamp final volume in the right place. --- pcsx2/SPU2/Mixer.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/pcsx2/SPU2/Mixer.cpp b/pcsx2/SPU2/Mixer.cpp index 434e4b2f7e..f2d205cfec 100644 --- a/pcsx2/SPU2/Mixer.cpp +++ b/pcsx2/SPU2/Mixer.cpp @@ -808,21 +808,24 @@ __forceinline Out.Left = MulShr32(Out.Left << SndOutVolumeShift, Cores[1].MasterVol.Left.Value); Out.Right = MulShr32(Out.Right << SndOutVolumeShift, Cores[1].MasterVol.Right.Value); - // Final Clamp! - // Like any good audio system, the PS2 pumps the volume and incurs some distortion in its - // output, giving us a nice thumpy sound at times. So we add 1 above (2x volume pump) and - // then clamp it all here. - - // Edit: I'm sorry Jake, but I know of no good audio system that arbitrary distorts and clips - // output by design. - // Good thing though that this code gets the volume exactly right, as per tests :) - Out = clamp_mix(Out, SndOutVolumeShift); + + } // Configurable output volume Out.Left *= FinalVolume; Out.Right *= FinalVolume; + // Final Clamp! + // Like any good audio system, the PS2 pumps the volume and incurs some distortion in its + // output, giving us a nice thumpy sound at times. So we add 1 above (2x volume pump) and + // then clamp it all here. + + // Edit: I'm sorry Jake, but I know of no good audio system that arbitrary distorts and clips + // output by design. + // Good thing though that this code gets the volume exactly right, as per tests :) + Out = clamp_mix(Out, SndOutVolumeShift); + SndBuffer::Write(Out); if (SampleRate == 96000) // Double up samples for 96khz (Port Audio Non-Exclusive)