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
Родитель 1b5fee3ae2
Коммит ad0b48363f
1 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -376,7 +376,10 @@ 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);
@ -384,8 +387,7 @@ public:
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);