diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2015-12-11 07:04:56 -0500 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2015-12-11 07:04:56 -0500 |
| commit | cb5be45f728ae282177c31daded54fbce1e5285f (patch) | |
| tree | a5dae52b850a924ac60aab80fe019d4f38256acc /Source/Core/AudioCommon/Mixer.cpp | |
| parent | 8acf8cf4d07684e9dc515a22b642e66e8fe7e231 (diff) | |
| parent | 888c377b57eae52e5710c35ca590f8b5d42b78ff (diff) | |
Merge pull request #3200 from degasus/master
Throttler + Mixer: Configureable variance
Diffstat (limited to 'Source/Core/AudioCommon/Mixer.cpp')
| -rw-r--r-- | Source/Core/AudioCommon/Mixer.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp index 1d76b5c8c2..8d2380b4cf 100644 --- a/Source/Core/AudioCommon/Mixer.cpp +++ b/Source/Core/AudioCommon/Mixer.cpp @@ -47,9 +47,12 @@ unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples, boo u32 indexR = m_indexR.load(); u32 indexW = m_indexW.load(); + int low_waterwark = m_input_sample_rate * SConfig::GetInstance().iTimingVariance / 1000; + low_waterwark = std::min(low_waterwark, MAX_SAMPLES / 2); + float numLeft = (float)(((indexW - indexR) & INDEX_MASK) / 2); m_numLeftI = (numLeft + m_numLeftI*(CONTROL_AVG-1)) / CONTROL_AVG; - float offset = (m_numLeftI - LOW_WATERMARK) * CONTROL_FACTOR; + float offset = (m_numLeftI - low_waterwark) * CONTROL_FACTOR; if (offset > MAX_FREQ_SHIFT) offset = MAX_FREQ_SHIFT; if (offset < -MAX_FREQ_SHIFT) offset = -MAX_FREQ_SHIFT; |
