AX: rename main depop fields and mixer flags

This commit is contained in:
Tillmann Karras 2022-05-07 14:44:49 +01:00
parent 048469f7c2
commit e6e283a11c
5 changed files with 72 additions and 53 deletions

View File

@ -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)

View File

@ -28,12 +28,13 @@ 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_RAMP = 0x000080,
@ -54,7 +55,10 @@ enum AXMixControl
MIX_AUXC_R = 0x100000,
MIX_AUXC_R_RAMP = 0x200000,
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

View File

@ -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;

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 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

View File

@ -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)