mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 997870 - Optimize OscillatorNodeEngine::ComputeCustom a little. r=karlt
--HG-- extra : rebase_source : 6d88a2154196c8c34521e246061e9581b98f70a1
This commit is contained in:
parent
be30f76960
commit
e2587f5bd7
@ -151,15 +151,15 @@ public:
|
||||
{
|
||||
double frequency, detune;
|
||||
|
||||
bool simpleFrequency = mFrequency.HasSimpleValue();
|
||||
bool simpleDetune = mDetune.HasSimpleValue();
|
||||
|
||||
// Shortcut if frequency-related AudioParam are not automated, and we
|
||||
// already have computed the frequency information and related parameters.
|
||||
if (simpleFrequency && simpleDetune && !mRecomputeParameters) {
|
||||
if (!ParametersMayNeedUpdate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool simpleFrequency = mFrequency.HasSimpleValue();
|
||||
bool simpleDetune = mDetune.HasSimpleValue();
|
||||
|
||||
if (simpleFrequency) {
|
||||
frequency = mFrequency.GetValue();
|
||||
} else {
|
||||
@ -212,6 +212,13 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool ParametersMayNeedUpdate()
|
||||
{
|
||||
return !mDetune.HasSimpleValue() ||
|
||||
!mFrequency.HasSimpleValue() ||
|
||||
mRecomputeParameters;
|
||||
}
|
||||
|
||||
void ComputeCustom(float* aOutput,
|
||||
StreamTime ticks,
|
||||
uint32_t aStart,
|
||||
@ -231,12 +238,22 @@ public:
|
||||
// mPhase runs [0,periodicWaveSize) here instead of [0,2*M_PI).
|
||||
float basePhaseIncrement = mPeriodicWave->rateScale();
|
||||
|
||||
UpdateParametersIfNeeded(ticks, aStart);
|
||||
|
||||
bool parametersMayNeedUpdate = ParametersMayNeedUpdate();
|
||||
mPeriodicWave->waveDataForFundamentalFrequency(mFinalFrequency,
|
||||
lowerWaveData,
|
||||
higherWaveData,
|
||||
tableInterpolationFactor);
|
||||
|
||||
for (uint32_t i = aStart; i < aEnd; ++i) {
|
||||
UpdateParametersIfNeeded(ticks, i);
|
||||
mPeriodicWave->waveDataForFundamentalFrequency(mFinalFrequency,
|
||||
lowerWaveData,
|
||||
higherWaveData,
|
||||
tableInterpolationFactor);
|
||||
if (parametersMayNeedUpdate) {
|
||||
mPeriodicWave->waveDataForFundamentalFrequency(mFinalFrequency,
|
||||
lowerWaveData,
|
||||
higherWaveData,
|
||||
tableInterpolationFactor);
|
||||
UpdateParametersIfNeeded(ticks, i);
|
||||
}
|
||||
// Bilinear interpolation between adjacent samples in each table.
|
||||
float floorPhase = floorf(mPhase);
|
||||
uint32_t j1 = floorPhase;
|
||||
|
Loading…
Reference in New Issue
Block a user