Mixer: Convert defines into concrete variables

Gets defines out of global scope.
This commit is contained in:
Lioncash 2016-01-14 03:00:47 -05:00
parent fc6a2f490f
commit c70487163f
2 changed files with 7 additions and 9 deletions

View File

@ -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);

View File

@ -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: