Make a hack optional to fix 48KHz output mode with NewAX

This commit is contained in:
Pierre Bourdon 2012-11-14 11:25:27 +01:00
parent 0b275c20af
commit 6a1241c03e
2 changed files with 9 additions and 4 deletions

View File

@ -100,12 +100,17 @@ inline bool WritePB(u32 addr, AXPBWii &PB)
template<class ParamBlockType> template<class ParamBlockType>
inline void MixAddVoice(ParamBlockType &pb, inline void MixAddVoice(ParamBlockType &pb,
int *templbuffer, int *temprbuffer, int *templbuffer, int *temprbuffer,
int _iSize) int _iSize, bool resample = true)
{ {
if (pb.running) if (pb.running)
{ {
const u32 ratio = (u32)(((pb.src.ratio_hi << 16) + pb.src.ratio_lo) float ratioFactor;
* /*ratioFactor:*/((float)AudioInterface::GetAIDSampleRate() / (float)soundStream->GetMixer()->GetSampleRate())); if (resample)
ratioFactor = (float)AudioInterface::GetAIDSampleRate() / (float)soundStream->GetMixer()->GetSampleRate();
else
ratioFactor = 1.0;
const u32 ratio = (u32)(((pb.src.ratio_hi << 16) + pb.src.ratio_lo) * ratioFactor);
u32 sampleEnd = (pb.audio_addr.end_addr_hi << 16) | pb.audio_addr.end_addr_lo; u32 sampleEnd = (pb.audio_addr.end_addr_hi << 16) | pb.audio_addr.end_addr_lo;
u32 loopPos = (pb.audio_addr.loop_addr_hi << 16) | pb.audio_addr.loop_addr_lo; u32 loopPos = (pb.audio_addr.loop_addr_hi << 16) | pb.audio_addr.loop_addr_lo;

View File

@ -263,7 +263,7 @@ void CUCode_NewAX::ProcessPBList(u32 pb_addr)
VoiceHacks(pb); VoiceHacks(pb);
MixAddVoice(pb, m_samples_left + spms * curr_ms, MixAddVoice(pb, m_samples_left + spms * curr_ms,
m_samples_right + spms * curr_ms, spms); m_samples_right + spms * curr_ms, spms, false);
} }
WritePB(pb_addr, pb); WritePB(pb_addr, pb);