diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp index 505a3b2551..f35a671094 100644 --- a/Source/Core/AudioCommon/Mixer.cpp +++ b/Source/Core/AudioCommon/Mixer.cpp @@ -44,7 +44,7 @@ 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; + 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); diff --git a/Source/Core/AudioCommon/Mixer.h b/Source/Core/AudioCommon/Mixer.h index be3d9f33c9..008e059e44 100644 --- a/Source/Core/AudioCommon/Mixer.h +++ b/Source/Core/AudioCommon/Mixer.h @@ -10,14 +10,6 @@ #include "AudioCommon/WaveFile.h" #include "Common/CommonTypes.h" -// 16 bit Stereo -#define MAX_SAMPLES (1024 * 4) // 128 ms -#define INDEX_MASK (MAX_SAMPLES * 2 - 1) - -#define MAX_FREQ_SHIFT 200 // per 32000 Hz -#define CONTROL_FACTOR 0.2f // in freq_shift per fifo size offset -#define CONTROL_AVG 32 - class CMixer final { public: @@ -48,6 +40,12 @@ public: void UpdateSpeed(float val) { m_speed.store(val); } private: + static constexpr u32 MAX_SAMPLES = 1024 * 4; // 128 ms + static constexpr u32 INDEX_MASK = MAX_SAMPLES * 2 - 1; + static constexpr int MAX_FREQ_SHIFT = 200; // Per 32000 Hz + static constexpr float CONTROL_FACTOR = 0.2f; + static constexpr u32 CONTROL_AVG = 32; // In freq_shift per FIFO size offset + class MixerFifo final { public: