Bug 864613 - Take the dynamics compressor node's input chunk volume into account; r=padenot

--HG--
extra : rebase_source : d065091c344325b9c42c26307074d20ad81e0cd0
This commit is contained in:
Ehsan Akhgari 2013-04-22 22:16:42 -04:00
Родитель 65bfe783c9
Коммит ae2e659fa6
1 изменённых файлов: 14 добавлений и 1 удалений

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

@ -34,6 +34,7 @@
#include "nsDebug.h"
using mozilla::WEBAUDIO_BLOCK_SIZE;
using mozilla::AudioBlockCopyChannelWithScale;
namespace WebCore {
@ -174,10 +175,22 @@ void DynamicsCompressor::process(const AudioChunk* sourceChunk, AudioChunk* dest
setEmphasisParameters(filterStageGain, anchor, filterStageRatio);
}
float sourceWithVolume[WEBAUDIO_BLOCK_SIZE];
// Apply pre-emphasis filter.
// Note that the final three stages are computed in-place in the destination buffer.
for (unsigned i = 0; i < numberOfChannels; ++i) {
const float* sourceData = m_sourceChannels[i];
const float* sourceData;
if (sourceChunk->mVolume == 1.0f) {
// Fast path, the volume scale doesn't need to get taken into account
sourceData = m_sourceChannels[i];
} else {
AudioBlockCopyChannelWithScale(m_sourceChannels[i],
sourceChunk->mVolume,
sourceWithVolume);
sourceData = sourceWithVolume;
}
float* destinationData = m_destinationChannels[i];
ZeroPole* preFilters = m_preFilterPacks[i]->filters;