зеркало из https://github.com/mozilla/gecko-dev.git
b=924286 handle non-unit mVolume in BiquadFilterNode r=ehsan
--HG-- extra : transplant_source : %E5%9E%3E%5D%F2%E5%99%7B%88%DB%21%7D%1C%82%1A.q%26%F0%EA
This commit is contained in:
Родитель
31f8c782f2
Коммит
f0ee7f661f
|
@ -25,13 +25,14 @@ NS_INTERFACE_MAP_END_INHERITING(AudioNode)
|
|||
NS_IMPL_ADDREF_INHERITED(BiquadFilterNode, AudioNode)
|
||||
NS_IMPL_RELEASE_INHERITED(BiquadFilterNode, AudioNode)
|
||||
|
||||
void SetParamsOnBiquad(WebCore::Biquad& aBiquad,
|
||||
float aSampleRate,
|
||||
BiquadFilterType aType,
|
||||
double aFrequency,
|
||||
double aQ,
|
||||
double aGain,
|
||||
double aDetune)
|
||||
static void
|
||||
SetParamsOnBiquad(WebCore::Biquad& aBiquad,
|
||||
float aSampleRate,
|
||||
BiquadFilterType aType,
|
||||
double aFrequency,
|
||||
double aQ,
|
||||
double aGain,
|
||||
double aDetune)
|
||||
{
|
||||
const double nyquist = aSampleRate * 0.5;
|
||||
double normalizedFrequency = aFrequency / nyquist;
|
||||
|
@ -158,10 +159,16 @@ public:
|
|||
double gain = mGain.GetValueAtTime(pos);
|
||||
double detune = mDetune.GetValueAtTime(pos);
|
||||
|
||||
float inputBuffer[WEBAUDIO_BLOCK_SIZE];
|
||||
for (uint32_t i = 0; i < numberOfChannels; ++i) {
|
||||
auto input = static_cast<const float*>(aInput.mChannelData[i]);
|
||||
if (aInput.mVolume != 1.0) {
|
||||
AudioBlockCopyChannelWithScale(input, aInput.mVolume, inputBuffer);
|
||||
input = inputBuffer;
|
||||
}
|
||||
SetParamsOnBiquad(mBiquads[i], aStream->SampleRate(), mType, freq, q, gain, detune);
|
||||
|
||||
mBiquads[i].process(static_cast<const float*>(aInput.mChannelData[i]),
|
||||
mBiquads[i].process(input,
|
||||
static_cast<float*>(const_cast<void*>(aOutput->mChannelData[i])),
|
||||
aInput.GetDuration());
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче