From 7b408743092280afb79aac8a4f6d1f43b96f6bc3 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sat, 6 Jul 2013 12:53:38 +0200 Subject: [PATCH] Implement AX command 0x11 (SET_OPPOSITE_LR) --- .../Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp | 18 +++++++++++++++++- .../Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h | 3 ++- .../Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp index e28d5a32ae..411624a714 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp @@ -239,7 +239,11 @@ void CUCode_AX::HandleCommandList() MixAUXBLR(HILO_TO_32(addr), HILO_TO_32(addr2)); break; - case CMD_UNK_11: curr_idx += 2; break; + case CMD_SET_OPPOSITE_LR: + addr_hi = m_cmdlist[curr_idx++]; + addr_lo = m_cmdlist[curr_idx++]; + SetOppositeLR(HILO_TO_32(addr)); + break; case CMD_UNK_12: { @@ -589,6 +593,18 @@ void CUCode_AX::MixAUXBLR(u32 ul_addr, u32 dl_addr) } } +void CUCode_AX::SetOppositeLR(u32 src_addr) +{ + int* ptr = (int*)HLEMemory_Get_Pointer(src_addr); + for (u32 i = 0; i < 5 * 32; ++i) + { + int inp = Common::swap32(*ptr++); + m_samples_left[i] = -inp; + m_samples_right[i] = inp; + m_samples_surround[i] = 0; + } +} + void CUCode_AX::SendAUXAndMix(u32 main_auxa_up, u32 auxb_s_up, u32 main_l_dl, u32 main_r_dl, u32 auxb_l_dl, u32 auxb_r_dl) { diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h index ae2ada78fd..5af2daed12 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.h @@ -147,6 +147,7 @@ protected: void SetMainLR(u32 src_addr); void OutputSamples(u32 out_addr, u32 surround_addr); void MixAUXBLR(u32 ul_addr, u32 dl_addr); + void SetOppositeLR(u32 src_addr); void SendAUXAndMix(u32 main_auxa_up, u32 auxb_s_up, u32 main_l_dl, u32 main_r_dl, u32 auxb_l_dl, u32 auxb_r_dl); @@ -173,7 +174,7 @@ private: CMD_OUTPUT = 0x0E, CMD_END = 0x0F, CMD_MIX_AUXB_LR = 0x10, - CMD_UNK_11 = 0x11, + CMD_SET_OPPOSITE_LR = 0x11, CMD_UNK_12 = 0x12, CMD_SEND_AUX_AND_MIX = 0x13, }; diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h index 56d736c399..a353f0d02b 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h @@ -458,7 +458,9 @@ void ProcessVoice(PB_TYPE& pb, const AXBuffers& buffers, u16 count, AXMixControl // Optionally, execute a low pass filter if (pb.lpf.enabled) + { pb.lpf.yn1 = LowPassFilter(samples, count, pb.lpf.yn1, pb.lpf.a0, pb.lpf.b0); + } // Mix LRS, AUXA and AUXB depending on mixer_control // TODO: Handle DPL2 on AUXB.