mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1188704 trim unnecessary extra basic waveform coeffient r=rillian
The built-in waveforms are all odd and so realP[halfSize] was zero, and it would have been ignored in createBandLimitedTables even if it was non-zero. imagP[halfSize] was ignored as it was not involved in the inverse FFT. This returns the code to that prior to https://hg.mozilla.org/mozilla-central/diff/5377bce3b478/content/media/webaudio/blink/PeriodicWave.cpp#l1.276
This commit is contained in:
parent
f65f282f40
commit
f7dd852b26
@ -258,18 +258,16 @@ void PeriodicWave::generateBasicWaveform(OscillatorType shape)
|
||||
unsigned fftSize = periodicWaveSize();
|
||||
unsigned halfSize = fftSize / 2;
|
||||
|
||||
AudioFloatArray real(halfSize + 1);
|
||||
AudioFloatArray imag(halfSize + 1);
|
||||
AudioFloatArray real(halfSize);
|
||||
AudioFloatArray imag(halfSize);
|
||||
float* realP = real.Elements();
|
||||
float* imagP = imag.Elements();
|
||||
|
||||
// Clear DC and Nyquist.
|
||||
// Clear DC and imag value which is ignored.
|
||||
realP[0] = 0;
|
||||
imagP[0] = 0;
|
||||
realP[halfSize] = 0;
|
||||
imagP[halfSize] = 0;
|
||||
|
||||
for (unsigned n = 1; n < halfSize + 1; ++n) {
|
||||
for (unsigned n = 1; n < halfSize; ++n) {
|
||||
float omega = 2 * piFloat * n;
|
||||
float invOmega = 1 / omega;
|
||||
|
||||
@ -319,7 +317,7 @@ void PeriodicWave::generateBasicWaveform(OscillatorType shape)
|
||||
imagP[n] = b;
|
||||
}
|
||||
|
||||
createBandLimitedTables(realP, imagP, halfSize + 1);
|
||||
createBandLimitedTables(realP, imagP, halfSize);
|
||||
}
|
||||
|
||||
} // namespace WebCore
|
||||
|
Loading…
Reference in New Issue
Block a user