Skip to content

Commit

Permalink
SPU: Fix DC filter types and clamping
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ziemas authored and refractionpcsx2 committed Sep 24, 2023
1 parent 8b84b04 commit 0197aee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pcsx2/SPU2/Mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pcsx2/SPU2/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)];
Expand Down
2 changes: 1 addition & 1 deletion pcsx2/SPU2/spu2sys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0197aee

Please sign in to comment.