b=1074765 move const periodicWaveSize multiplier out of loop r=rillian

--HG--
extra : rebase_source : f09104d4df99cf36dd03c883eec2980d503b0c06
This commit is contained in:
Karl Tomlinson 2014-09-30 17:13:27 +13:00
parent 0c31695917
commit 7b2e924b39

View File

@ -376,16 +376,18 @@ public:
float* higherWaveData = nullptr;
float* lowerWaveData = nullptr;
float tableInterpolationFactor;
float rate = 1.0 / mSource->SampleRate();
// Phase increment at frequency of 1 Hz.
// mPhase runs [0,periodicWaveSize) here instead of [0,2*M_PI).
float basePhaseIncrement =
static_cast<float>(periodicWaveSize) / mSource->SampleRate();
for (uint32_t i = aStart; i < aEnd; ++i) {
UpdateParametersIfNeeded(ticks, i);
mPeriodicWave->waveDataForFundamentalFrequency(mFinalFrequency,
lowerWaveData,
higherWaveData,
tableInterpolationFactor);
// mPhase runs 0..periodicWaveSize here instead of 0..2*M_PI.
mPhase += periodicWaveSize * mFinalFrequency * rate;
mPhase += basePhaseIncrement * mFinalFrequency;
mPhase = fmod(mPhase, periodicWaveSize);
// Bilinear interpolation between adjacent samples in each table.
uint32_t j1 = floor(mPhase);