From e6e283a11c3f692bc0206d8ae0ecfe09778c86b0 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sat, 7 May 2022 14:44:49 +0100 Subject: [PATCH] AX: rename main depop fields and mixer flags --- Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp | 27 ++++--------- Source/Core/Core/HW/DSPHLE/UCodes/AX.h | 36 +++++++++-------- Source/Core/Core/HW/DSPHLE/UCodes/AXStructs.h | 12 +++--- Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h | 40 +++++++++++++++---- Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp | 10 ++--- 5 files changed, 72 insertions(+), 53 deletions(-) diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp index 77a3587ef1..43551712f8 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp @@ -291,44 +291,33 @@ AXMixControl AXUCode::ConvertMixerControl(u32 mixer_control) // TODO: find other UCode versions with different mixer_control values if (m_crc == 0x4e8a8b21) { - ret |= MIX_L | MIX_R; + ret |= MIX_MAIN_L | MIX_MAIN_R; if (mixer_control & 0x0001) ret |= MIX_AUXA_L | MIX_AUXA_R; if (mixer_control & 0x0002) ret |= MIX_AUXB_L | MIX_AUXB_R; if (mixer_control & 0x0004) { - ret |= MIX_S; + ret |= MIX_MAIN_S; if (ret & MIX_AUXA_L) ret |= MIX_AUXA_S; if (ret & MIX_AUXB_L) ret |= MIX_AUXB_S; } if (mixer_control & 0x0008) - { - ret |= MIX_L_RAMP | MIX_R_RAMP; - if (ret & MIX_S) - ret |= MIX_S_RAMP; - if (ret & MIX_AUXA_L) - ret |= MIX_AUXA_L_RAMP | MIX_AUXA_R_RAMP; - if (ret & MIX_AUXB_L) - ret |= MIX_AUXB_L_RAMP | MIX_AUXB_R_RAMP; - if (ret & MIX_AUXA_S) - ret |= MIX_AUXA_S_RAMP; - if (ret & MIX_AUXB_S) - ret |= MIX_AUXB_S_RAMP; - } + ret |= MIX_ALL_RAMPS; } else { + // newer GameCube ucodes if (mixer_control & 0x0001) - ret |= MIX_L; + ret |= MIX_MAIN_L; if (mixer_control & 0x0002) - ret |= MIX_R; + ret |= MIX_MAIN_R; if (mixer_control & 0x0004) - ret |= MIX_S; + ret |= MIX_MAIN_S; if (mixer_control & 0x0008) - ret |= MIX_L_RAMP | MIX_R_RAMP | MIX_S_RAMP; + ret |= MIX_MAIN_L_RAMP | MIX_MAIN_R_RAMP | MIX_MAIN_S_RAMP; if (mixer_control & 0x0010) ret |= MIX_AUXA_L; if (mixer_control & 0x0020) diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AX.h b/Source/Core/Core/HW/DSPHLE/UCodes/AX.h index 9e37b39035..1405379cd0 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AX.h +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AX.h @@ -28,33 +28,37 @@ class DSPHLE; // mixer_control value to an AXMixControl bitfield. enum AXMixControl { - MIX_L = 0x000001, - MIX_L_RAMP = 0x000002, - MIX_R = 0x000004, - MIX_R_RAMP = 0x000008, - MIX_S = 0x000010, - MIX_S_RAMP = 0x000020, + // clang-format off + MIX_MAIN_L = 0x000001, + MIX_MAIN_L_RAMP = 0x000002, + MIX_MAIN_R = 0x000004, + MIX_MAIN_R_RAMP = 0x000008, + MIX_MAIN_S = 0x000010, + MIX_MAIN_S_RAMP = 0x000020, - MIX_AUXA_L = 0x000040, + MIX_AUXA_L = 0x000040, MIX_AUXA_L_RAMP = 0x000080, - MIX_AUXA_R = 0x000100, + MIX_AUXA_R = 0x000100, MIX_AUXA_R_RAMP = 0x000200, - MIX_AUXA_S = 0x000400, + MIX_AUXA_S = 0x000400, MIX_AUXA_S_RAMP = 0x000800, - MIX_AUXB_L = 0x001000, + MIX_AUXB_L = 0x001000, MIX_AUXB_L_RAMP = 0x002000, - MIX_AUXB_R = 0x004000, + MIX_AUXB_R = 0x004000, MIX_AUXB_R_RAMP = 0x008000, - MIX_AUXB_S = 0x010000, + MIX_AUXB_S = 0x010000, MIX_AUXB_S_RAMP = 0x020000, - MIX_AUXC_L = 0x040000, + MIX_AUXC_L = 0x040000, MIX_AUXC_L_RAMP = 0x080000, - MIX_AUXC_R = 0x100000, + MIX_AUXC_R = 0x100000, MIX_AUXC_R_RAMP = 0x200000, - MIX_AUXC_S = 0x400000, - MIX_AUXC_S_RAMP = 0x800000 + MIX_AUXC_S = 0x400000, + MIX_AUXC_S_RAMP = 0x800000, + + MIX_ALL_RAMPS = 0xAAAAAA, + // clang-format on }; class AXUCode : public UCodeInterface diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AXStructs.h b/Source/Core/Core/HW/DSPHLE/UCodes/AXStructs.h index 74f1338dec..e34ffcc323 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AXStructs.h +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AXStructs.h @@ -75,32 +75,32 @@ struct PBUpdates // and ramped down on a per-sample basis to provide a gentle "roll off." struct PBDpop { - s16 left; + s16 main_left; s16 auxA_left; s16 auxB_left; - s16 right; + s16 main_right; s16 auxA_right; s16 auxB_right; - s16 surround; + s16 main_surround; s16 auxA_surround; s16 auxB_surround; }; struct PBDpopWii { - s16 left; + s16 main_left; s16 auxA_left; s16 auxB_left; s16 auxC_left; - s16 right; + s16 main_right; s16 auxA_right; s16 auxB_right; s16 auxC_right; - s16 surround; + s16 main_surround; s16 auxA_surround; s16 auxB_surround; s16 auxC_surround; diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h b/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h index a5fa30f165..2ff03c347d 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h @@ -428,44 +428,70 @@ void ProcessVoice(PB_TYPE& pb, const AXBuffers& buffers, u16 count, AXMixControl #define MIX_ON(C) (0 != (mctrl & MIX_##C)) #define RAMP_ON(C) (0 != (mctrl & MIX_##C##_RAMP)) - if (MIX_ON(L)) - MixAdd(buffers.main_left, samples, count, &pb.mixer.main_left, &pb.dpop.left, RAMP_ON(L)); - if (MIX_ON(R)) - MixAdd(buffers.main_right, samples, count, &pb.mixer.main_right, &pb.dpop.right, RAMP_ON(R)); - if (MIX_ON(S)) - MixAdd(buffers.main_surround, samples, count, &pb.mixer.main_surround, &pb.dpop.surround, - RAMP_ON(S)); + if (MIX_ON(MAIN_L)) + { + MixAdd(buffers.main_left, samples, count, &pb.mixer.main_left, &pb.dpop.main_left, + RAMP_ON(MAIN_L)); + } + if (MIX_ON(MAIN_R)) + { + MixAdd(buffers.main_right, samples, count, &pb.mixer.main_right, &pb.dpop.main_right, + RAMP_ON(MAIN_R)); + } + if (MIX_ON(MAIN_S)) + { + MixAdd(buffers.main_surround, samples, count, &pb.mixer.main_surround, &pb.dpop.main_surround, + RAMP_ON(MAIN_S)); + } if (MIX_ON(AUXA_L)) + { MixAdd(buffers.auxA_left, samples, count, &pb.mixer.auxA_left, &pb.dpop.auxA_left, RAMP_ON(AUXA_L)); + } if (MIX_ON(AUXA_R)) + { MixAdd(buffers.auxA_right, samples, count, &pb.mixer.auxA_right, &pb.dpop.auxA_right, RAMP_ON(AUXA_R)); + } if (MIX_ON(AUXA_S)) + { MixAdd(buffers.auxA_surround, samples, count, &pb.mixer.auxA_surround, &pb.dpop.auxA_surround, RAMP_ON(AUXA_S)); + } if (MIX_ON(AUXB_L)) + { MixAdd(buffers.auxB_left, samples, count, &pb.mixer.auxB_left, &pb.dpop.auxB_left, RAMP_ON(AUXB_L)); + } if (MIX_ON(AUXB_R)) + { MixAdd(buffers.auxB_right, samples, count, &pb.mixer.auxB_right, &pb.dpop.auxB_right, RAMP_ON(AUXB_R)); + } if (MIX_ON(AUXB_S)) + { MixAdd(buffers.auxB_surround, samples, count, &pb.mixer.auxB_surround, &pb.dpop.auxB_surround, RAMP_ON(AUXB_S)); + } #ifdef AX_WII if (MIX_ON(AUXC_L)) + { MixAdd(buffers.auxC_left, samples, count, &pb.mixer.auxC_left, &pb.dpop.auxC_left, RAMP_ON(AUXC_L)); + } if (MIX_ON(AUXC_R)) + { MixAdd(buffers.auxC_right, samples, count, &pb.mixer.auxC_right, &pb.dpop.auxC_right, RAMP_ON(AUXC_R)); + } if (MIX_ON(AUXC_S)) + { MixAdd(buffers.auxC_surround, samples, count, &pb.mixer.auxC_surround, &pb.dpop.auxC_surround, RAMP_ON(AUXC_S)); + } #endif #undef MIX_ON diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp index e7a50c52cf..96a84aa7e3 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp @@ -331,15 +331,15 @@ AXMixControl AXWiiUCode::ConvertMixerControl(u32 mixer_control) u32 ret = 0; if (mixer_control & 0x00000001) - ret |= MIX_L; + ret |= MIX_MAIN_L; if (mixer_control & 0x00000002) - ret |= MIX_R; + ret |= MIX_MAIN_R; if (mixer_control & 0x00000004) - ret |= MIX_L_RAMP | MIX_R_RAMP; + ret |= MIX_MAIN_L_RAMP | MIX_MAIN_R_RAMP; if (mixer_control & 0x00000008) - ret |= MIX_S; + ret |= MIX_MAIN_S; if (mixer_control & 0x00000010) - ret |= MIX_S_RAMP; + ret |= MIX_MAIN_S_RAMP; if (mixer_control & 0x00010000) ret |= MIX_AUXA_L; if (mixer_control & 0x00020000)