From 0197aeeb4bb5203cad0394d551180a91218e508f Mon Sep 17 00:00:00 2001 From: Ziemas Date: Sun, 24 Sep 2023 19:22:43 +0200 Subject: [PATCH] SPU: Fix DC filter types and clamping Fix wrong type being used for dc filter state. The filter seems to introduce some small amount of gain, so we need to clamp it. --- pcsx2/SPU2/Mixer.cpp | 2 +- pcsx2/SPU2/defs.h | 2 +- pcsx2/SPU2/spu2sys.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pcsx2/SPU2/Mixer.cpp b/pcsx2/SPU2/Mixer.cpp index f88e79f61075c..2d9fb5bccf5fd 100644 --- a/pcsx2/SPU2/Mixer.cpp +++ b/pcsx2/SPU2/Mixer.cpp @@ -691,8 +691,8 @@ __forceinline // 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); Out = DCFilter(Out); + Out = clamp_mix(Out); SndBuffer::Write(StereoOut16(Out)); // Update AutoDMA output positioning diff --git a/pcsx2/SPU2/defs.h b/pcsx2/SPU2/defs.h index 528a5ad5fb405..b0d351b32c344 100644 --- a/pcsx2/SPU2/defs.h +++ b/pcsx2/SPU2/defs.h @@ -514,7 +514,7 @@ extern u16 InputPos; // SPU Mixing Cycles ("Ticks mixed" counter) extern u32 Cycles; // DC Filter state -extern StereoOut16 DCFilterIn, DCFilterOut; +extern StereoOut32 DCFilterIn, DCFilterOut; extern s16 spu2regs[0x010000 / sizeof(s16)]; extern s16 _spu2mem[0x200000 / sizeof(s16)]; diff --git a/pcsx2/SPU2/spu2sys.cpp b/pcsx2/SPU2/spu2sys.cpp index 1fbf0d6f4492d..d6ef3540c75c2 100644 --- a/pcsx2/SPU2/spu2sys.cpp +++ b/pcsx2/SPU2/spu2sys.cpp @@ -37,7 +37,7 @@ V_CoreDebug DebugCores[2]; V_Core Cores[2]; V_SPDIF Spdif; -StereoOut16 DCFilterIn, DCFilterOut; +StereoOut32 DCFilterIn, DCFilterOut; u16 OutPos; u16 InputPos; u32 Cycles;