Mixer: Disable frequency shifting when stretching is enabled

This commit is contained in:
MerryMage 2017-04-11 10:07:21 +01:00
parent 71e748b68f
commit ac0df5b2db
1 changed files with 14 additions and 13 deletions

View File

@ -47,10 +47,19 @@ unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples,
u32 indexR = m_indexR.load();
u32 indexW = m_indexW.load();
// render numleft sample pairs to samples[]
// advance indexR with sample position
// remember fractional offset
float emulationspeed = SConfig::GetInstance().m_EmulationSpeed;
float aid_sample_rate = static_cast<float>(m_input_sample_rate);
if (consider_framelimit && emulationspeed > 0.0f)
{
float numLeft = static_cast<float>(((indexW - indexR) & INDEX_MASK) / 2);
u32 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_waterwark) * CONTROL_FACTOR;
if (offset > MAX_FREQ_SHIFT)
@ -58,15 +67,7 @@ unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples,
if (offset < -MAX_FREQ_SHIFT)
offset = -MAX_FREQ_SHIFT;
// render numleft sample pairs to samples[]
// advance indexR with sample position
// remember fractional offset
float emulationspeed = SConfig::GetInstance().m_EmulationSpeed;
float aid_sample_rate = m_input_sample_rate + offset;
if (consider_framelimit && emulationspeed > 0.0f)
{
aid_sample_rate = aid_sample_rate * emulationspeed;
aid_sample_rate = (aid_sample_rate + offset) * emulationspeed;
}
const u32 ratio = (u32)(65536.0f * aid_sample_rate / (float)m_mixer->m_sampleRate);