Implement AX command 0x11 (SET_OPPOSITE_LR)

This commit is contained in:
Pierre Bourdon 2013-07-06 12:53:38 +02:00
parent b2e7248b58
commit 7b40874309
3 changed files with 21 additions and 2 deletions

View File

@ -239,7 +239,11 @@ void CUCode_AX::HandleCommandList()
MixAUXBLR(HILO_TO_32(addr), HILO_TO_32(addr2)); MixAUXBLR(HILO_TO_32(addr), HILO_TO_32(addr2));
break; 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: 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, 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) u32 main_r_dl, u32 auxb_l_dl, u32 auxb_r_dl)
{ {

View File

@ -147,6 +147,7 @@ protected:
void SetMainLR(u32 src_addr); void SetMainLR(u32 src_addr);
void OutputSamples(u32 out_addr, u32 surround_addr); void OutputSamples(u32 out_addr, u32 surround_addr);
void MixAUXBLR(u32 ul_addr, u32 dl_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, 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); u32 main_r_dl, u32 auxb_l_dl, u32 auxb_r_dl);
@ -173,7 +174,7 @@ private:
CMD_OUTPUT = 0x0E, CMD_OUTPUT = 0x0E,
CMD_END = 0x0F, CMD_END = 0x0F,
CMD_MIX_AUXB_LR = 0x10, CMD_MIX_AUXB_LR = 0x10,
CMD_UNK_11 = 0x11, CMD_SET_OPPOSITE_LR = 0x11,
CMD_UNK_12 = 0x12, CMD_UNK_12 = 0x12,
CMD_SEND_AUX_AND_MIX = 0x13, CMD_SEND_AUX_AND_MIX = 0x13,
}; };

View File

@ -458,7 +458,9 @@ void ProcessVoice(PB_TYPE& pb, const AXBuffers& buffers, u16 count, AXMixControl
// Optionally, execute a low pass filter // Optionally, execute a low pass filter
if (pb.lpf.enabled) if (pb.lpf.enabled)
{
pb.lpf.yn1 = LowPassFilter(samples, count, pb.lpf.yn1, pb.lpf.a0, pb.lpf.b0); pb.lpf.yn1 = LowPassFilter(samples, count, pb.lpf.yn1, pb.lpf.a0, pb.lpf.b0);
}
// Mix LRS, AUXA and AUXB depending on mixer_control // Mix LRS, AUXA and AUXB depending on mixer_control
// TODO: Handle DPL2 on AUXB. // TODO: Handle DPL2 on AUXB.