diff options
| author | degasus <wickmarkus@web.de> | 2014-02-11 14:53:53 +0100 |
|---|---|---|
| committer | degasus <wickmarkus@web.de> | 2014-02-11 14:53:53 +0100 |
| commit | bbd58b8f6af60ae7743dea4efc05107a53dd4abf (patch) | |
| tree | a40aead02b2b36b630da2561b4ff7eb21cbf46c8 /Source/Core | |
| parent | ca9fd64df916949518fe8dfd3ca9c0432eade388 (diff) | |
change AI sampling rate based on framelimit
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/AudioCommon/Mixer.cpp | 11 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/Mixer.h | 4 |
2 files changed, 12 insertions, 3 deletions
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 { |
