diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp index 99c5a56176..31698a931d 100644 --- a/Source/Core/AudioCommon/Mixer.cpp +++ b/Source/Core/AudioCommon/Mixer.cpp @@ -7,6 +7,8 @@ #include "AudioCommon.h" #include "CPUDetect.h" #include "../Core/Host.h" +#include "ConfigManager.h" +#include "HW/VideoInterface.h" #include "../Core/HW/AudioInterface.h" @@ -54,8 +56,15 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples) //advance indexR with sample position //remember fractional offset + u32 framelimit = SConfig::GetInstance().m_Framelimit; + float aid_sample_rate = AudioInterface::GetAIDSampleRate() + offset; + if (framelimit > 2) + { + aid_sample_rate = aid_sample_rate * (framelimit - 1) * 5 / VideoInterface::TargetRefreshRate; + } + static u32 frac = 0; - const u32 ratio = (u32)( 65536.0f * (float)AudioInterface::GetAIDSampleRate() / (float)m_sampleRate + offset ); + const u32 ratio = (u32)( 65536.0f * aid_sample_rate / (float)m_sampleRate ); if(ratio > 0x10000) ERROR_LOG(AUDIO, "ratio out of range"); diff --git a/Source/Core/AudioCommon/Mixer.h b/Source/Core/AudioCommon/Mixer.h index 954aa7b99a..4f31d66d7e 100644 --- a/Source/Core/AudioCommon/Mixer.h +++ b/Source/Core/AudioCommon/Mixer.h @@ -12,8 +12,8 @@ #define INDEX_MASK (MAX_SAMPLES * 2 - 1) #define LOW_WATERMARK 1280 // 40 ms -#define MAX_FREQ_SHIFT 0x0100 // of 0x10000 -#define CONTROL_FACTOR 0.3 // in freq_shift per fifo size offset +#define MAX_FREQ_SHIFT 200 // per 32000 Hz +#define CONTROL_FACTOR 0.2 // in freq_shift per fifo size offset #define CONTROL_AVG 32 class CMixer {