Skip to content

Commit

Permalink
SPU2: Put clamp_mix in header for more inlining
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziemas committed Oct 19, 2023
1 parent 4b23759 commit 0b35a98
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
10 changes: 0 additions & 10 deletions pcsx2/SPU2/Mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ static const s32 tbl_XA_Factor[16][2] =
{98, -55},
{122, -60}};

__forceinline s32 clamp_mix(s32 x)
{
return std::clamp(x, -0x8000, 0x7fff);
}

__forceinline StereoOut32 clamp_mix(StereoOut32 sample)
{
return StereoOut32(clamp_mix(sample.Left), clamp_mix(sample.Right));
}

static void __forceinline XA_decode_block(s16* buffer, const s16* block, s32& prev1, s32& prev2)
{
const s32 header = *block;
Expand Down
2 changes: 0 additions & 2 deletions pcsx2/SPU2/Mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,3 @@
#pragma once

extern void Mix();
extern s32 clamp_mix(s32 x);
extern StereoOut32 clamp_mix(StereoOut32 sample);
12 changes: 11 additions & 1 deletion pcsx2/SPU2/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,21 @@ extern s16 spu2M_Read(u32 addr);
extern void spu2M_Write(u32 addr, s16 value);
extern void spu2M_Write(u32 addr, u16 value);

static inline s16 SignExtend16(u16 v)
static __forceinline s16 SignExtend16(u16 v)
{
return (s16)v;
}

static __forceinline s32 clamp_mix(s32 x)
{
return std::clamp(x, -0x8000, 0x7fff);
}

static __forceinline StereoOut32 clamp_mix(StereoOut32 sample)
{
return StereoOut32(clamp_mix(sample.Left), clamp_mix(sample.Right));
}

struct V_VolumeLR
{
static V_VolumeLR Max;
Expand Down

0 comments on commit 0b35a98

Please sign in to comment.