Merge pull request #10643 from Tilka/ax_cleanup

AX: fix missing ramp of main surround channel
This commit is contained in:
Tilka 2022-05-12 21:12:04 +01:00 committed by GitHub
commit 333659cefa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 72 additions and 51 deletions

View file

@ -291,42 +291,33 @@ AXMixControl AXUCode::ConvertMixerControl(u32 mixer_control)
// TODO: find other UCode versions with different mixer_control values // TODO: find other UCode versions with different mixer_control values
if (m_crc == 0x4e8a8b21) if (m_crc == 0x4e8a8b21)
{ {
ret |= MIX_L | MIX_R; ret |= MIX_MAIN_L | MIX_MAIN_R;
if (mixer_control & 0x0001) if (mixer_control & 0x0001)
ret |= MIX_AUXA_L | MIX_AUXA_R; ret |= MIX_AUXA_L | MIX_AUXA_R;
if (mixer_control & 0x0002) if (mixer_control & 0x0002)
ret |= MIX_AUXB_L | MIX_AUXB_R; ret |= MIX_AUXB_L | MIX_AUXB_R;
if (mixer_control & 0x0004) if (mixer_control & 0x0004)
{ {
ret |= MIX_S; ret |= MIX_MAIN_S;
if (ret & MIX_AUXA_L) if (ret & MIX_AUXA_L)
ret |= MIX_AUXA_S; ret |= MIX_AUXA_S;
if (ret & MIX_AUXB_L) if (ret & MIX_AUXB_L)
ret |= MIX_AUXB_S; ret |= MIX_AUXB_S;
} }
if (mixer_control & 0x0008) if (mixer_control & 0x0008)
{ ret |= MIX_ALL_RAMPS;
ret |= MIX_L_RAMP | MIX_R_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;
}
} }
else else
{ {
// newer GameCube ucodes
if (mixer_control & 0x0001) if (mixer_control & 0x0001)
ret |= MIX_L; ret |= MIX_MAIN_L;
if (mixer_control & 0x0002) if (mixer_control & 0x0002)
ret |= MIX_R; ret |= MIX_MAIN_R;
if (mixer_control & 0x0004) if (mixer_control & 0x0004)
ret |= MIX_S; ret |= MIX_MAIN_S;
if (mixer_control & 0x0008) 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) if (mixer_control & 0x0010)
ret |= MIX_AUXA_L; ret |= MIX_AUXA_L;
if (mixer_control & 0x0020) if (mixer_control & 0x0020)

View file

@ -28,12 +28,13 @@ class DSPHLE;
// mixer_control value to an AXMixControl bitfield. // mixer_control value to an AXMixControl bitfield.
enum AXMixControl enum AXMixControl
{ {
MIX_L = 0x000001, // clang-format off
MIX_L_RAMP = 0x000002, MIX_MAIN_L = 0x000001,
MIX_R = 0x000004, MIX_MAIN_L_RAMP = 0x000002,
MIX_R_RAMP = 0x000008, MIX_MAIN_R = 0x000004,
MIX_S = 0x000010, MIX_MAIN_R_RAMP = 0x000008,
MIX_S_RAMP = 0x000020, MIX_MAIN_S = 0x000010,
MIX_MAIN_S_RAMP = 0x000020,
MIX_AUXA_L = 0x000040, MIX_AUXA_L = 0x000040,
MIX_AUXA_L_RAMP = 0x000080, MIX_AUXA_L_RAMP = 0x000080,
@ -54,7 +55,10 @@ enum AXMixControl
MIX_AUXC_R = 0x100000, MIX_AUXC_R = 0x100000,
MIX_AUXC_R_RAMP = 0x200000, MIX_AUXC_R_RAMP = 0x200000,
MIX_AUXC_S = 0x400000, MIX_AUXC_S = 0x400000,
MIX_AUXC_S_RAMP = 0x800000 MIX_AUXC_S_RAMP = 0x800000,
MIX_ALL_RAMPS = 0xAAAAAA,
// clang-format on
}; };
class AXUCode : public UCodeInterface class AXUCode : public UCodeInterface

View file

@ -75,32 +75,32 @@ struct PBUpdates
// and ramped down on a per-sample basis to provide a gentle "roll off." // and ramped down on a per-sample basis to provide a gentle "roll off."
struct PBDpop struct PBDpop
{ {
s16 left; s16 main_left;
s16 auxA_left; s16 auxA_left;
s16 auxB_left; s16 auxB_left;
s16 right; s16 main_right;
s16 auxA_right; s16 auxA_right;
s16 auxB_right; s16 auxB_right;
s16 surround; s16 main_surround;
s16 auxA_surround; s16 auxA_surround;
s16 auxB_surround; s16 auxB_surround;
}; };
struct PBDpopWii struct PBDpopWii
{ {
s16 left; s16 main_left;
s16 auxA_left; s16 auxA_left;
s16 auxB_left; s16 auxB_left;
s16 auxC_left; s16 auxC_left;
s16 right; s16 main_right;
s16 auxA_right; s16 auxA_right;
s16 auxB_right; s16 auxB_right;
s16 auxC_right; s16 auxC_right;
s16 surround; s16 main_surround;
s16 auxA_surround; s16 auxA_surround;
s16 auxB_surround; s16 auxB_surround;
s16 auxC_surround; s16 auxC_surround;

View file

@ -428,44 +428,70 @@ void ProcessVoice(PB_TYPE& pb, const AXBuffers& buffers, u16 count, AXMixControl
#define MIX_ON(C) (0 != (mctrl & MIX_##C)) #define MIX_ON(C) (0 != (mctrl & MIX_##C))
#define RAMP_ON(C) (0 != (mctrl & MIX_##C##_RAMP)) #define RAMP_ON(C) (0 != (mctrl & MIX_##C##_RAMP))
if (MIX_ON(L)) if (MIX_ON(MAIN_L))
MixAdd(buffers.main_left, samples, count, &pb.mixer.main_left, &pb.dpop.left, RAMP_ON(L)); {
if (MIX_ON(R)) MixAdd(buffers.main_left, samples, count, &pb.mixer.main_left, &pb.dpop.main_left,
MixAdd(buffers.main_right, samples, count, &pb.mixer.main_right, &pb.dpop.right, RAMP_ON(R)); RAMP_ON(MAIN_L));
if (MIX_ON(S)) }
MixAdd(buffers.main_surround, samples, count, &pb.mixer.main_surround, &pb.dpop.surround, if (MIX_ON(MAIN_R))
RAMP_ON(S)); {
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)) if (MIX_ON(AUXA_L))
{
MixAdd(buffers.auxA_left, samples, count, &pb.mixer.auxA_left, &pb.dpop.auxA_left, MixAdd(buffers.auxA_left, samples, count, &pb.mixer.auxA_left, &pb.dpop.auxA_left,
RAMP_ON(AUXA_L)); RAMP_ON(AUXA_L));
}
if (MIX_ON(AUXA_R)) if (MIX_ON(AUXA_R))
{
MixAdd(buffers.auxA_right, samples, count, &pb.mixer.auxA_right, &pb.dpop.auxA_right, MixAdd(buffers.auxA_right, samples, count, &pb.mixer.auxA_right, &pb.dpop.auxA_right,
RAMP_ON(AUXA_R)); RAMP_ON(AUXA_R));
}
if (MIX_ON(AUXA_S)) if (MIX_ON(AUXA_S))
{
MixAdd(buffers.auxA_surround, samples, count, &pb.mixer.auxA_surround, &pb.dpop.auxA_surround, MixAdd(buffers.auxA_surround, samples, count, &pb.mixer.auxA_surround, &pb.dpop.auxA_surround,
RAMP_ON(AUXA_S)); RAMP_ON(AUXA_S));
}
if (MIX_ON(AUXB_L)) if (MIX_ON(AUXB_L))
{
MixAdd(buffers.auxB_left, samples, count, &pb.mixer.auxB_left, &pb.dpop.auxB_left, MixAdd(buffers.auxB_left, samples, count, &pb.mixer.auxB_left, &pb.dpop.auxB_left,
RAMP_ON(AUXB_L)); RAMP_ON(AUXB_L));
}
if (MIX_ON(AUXB_R)) if (MIX_ON(AUXB_R))
{
MixAdd(buffers.auxB_right, samples, count, &pb.mixer.auxB_right, &pb.dpop.auxB_right, MixAdd(buffers.auxB_right, samples, count, &pb.mixer.auxB_right, &pb.dpop.auxB_right,
RAMP_ON(AUXB_R)); RAMP_ON(AUXB_R));
}
if (MIX_ON(AUXB_S)) if (MIX_ON(AUXB_S))
{
MixAdd(buffers.auxB_surround, samples, count, &pb.mixer.auxB_surround, &pb.dpop.auxB_surround, MixAdd(buffers.auxB_surround, samples, count, &pb.mixer.auxB_surround, &pb.dpop.auxB_surround,
RAMP_ON(AUXB_S)); RAMP_ON(AUXB_S));
}
#ifdef AX_WII #ifdef AX_WII
if (MIX_ON(AUXC_L)) if (MIX_ON(AUXC_L))
{
MixAdd(buffers.auxC_left, samples, count, &pb.mixer.auxC_left, &pb.dpop.auxC_left, MixAdd(buffers.auxC_left, samples, count, &pb.mixer.auxC_left, &pb.dpop.auxC_left,
RAMP_ON(AUXC_L)); RAMP_ON(AUXC_L));
}
if (MIX_ON(AUXC_R)) if (MIX_ON(AUXC_R))
{
MixAdd(buffers.auxC_right, samples, count, &pb.mixer.auxC_right, &pb.dpop.auxC_right, MixAdd(buffers.auxC_right, samples, count, &pb.mixer.auxC_right, &pb.dpop.auxC_right,
RAMP_ON(AUXC_R)); RAMP_ON(AUXC_R));
}
if (MIX_ON(AUXC_S)) if (MIX_ON(AUXC_S))
{
MixAdd(buffers.auxC_surround, samples, count, &pb.mixer.auxC_surround, &pb.dpop.auxC_surround, MixAdd(buffers.auxC_surround, samples, count, &pb.mixer.auxC_surround, &pb.dpop.auxC_surround,
RAMP_ON(AUXC_S)); RAMP_ON(AUXC_S));
}
#endif #endif
#undef MIX_ON #undef MIX_ON

View file

@ -331,15 +331,15 @@ AXMixControl AXWiiUCode::ConvertMixerControl(u32 mixer_control)
u32 ret = 0; u32 ret = 0;
if (mixer_control & 0x00000001) if (mixer_control & 0x00000001)
ret |= MIX_L; ret |= MIX_MAIN_L;
if (mixer_control & 0x00000002) if (mixer_control & 0x00000002)
ret |= MIX_R; ret |= MIX_MAIN_R;
if (mixer_control & 0x00000004) if (mixer_control & 0x00000004)
ret |= MIX_L_RAMP | MIX_R_RAMP; ret |= MIX_MAIN_L_RAMP | MIX_MAIN_R_RAMP;
if (mixer_control & 0x00000008) if (mixer_control & 0x00000008)
ret |= MIX_S; ret |= MIX_MAIN_S;
if (mixer_control & 0x00000010) if (mixer_control & 0x00000010)
ret |= MIX_S_RAMP; ret |= MIX_MAIN_S_RAMP;
if (mixer_control & 0x00010000) if (mixer_control & 0x00010000)
ret |= MIX_AUXA_L; ret |= MIX_AUXA_L;
if (mixer_control & 0x00020000) if (mixer_control & 0x00020000)