Index: Source/modules/webaudio/WaveShaperProcessor.cpp |
diff --git a/Source/modules/webaudio/WaveShaperProcessor.cpp b/Source/modules/webaudio/WaveShaperProcessor.cpp |
index c560de5bb9efc3d13ae6dacaf29b21109838a968..f4b5efa728f0bab4f4312c95b3304e0758d975bb 100644 |
--- a/Source/modules/webaudio/WaveShaperProcessor.cpp |
+++ b/Source/modules/webaudio/WaveShaperProcessor.cpp |
@@ -31,9 +31,10 @@ |
#include "modules/webaudio/WaveShaperDSPKernel.h" |
namespace WebCore { |
- |
+ |
WaveShaperProcessor::WaveShaperProcessor(float sampleRate, size_t numberOfChannels) |
: AudioDSPKernelProcessor(sampleRate, numberOfChannels) |
+ , m_oversample(OverSampleNone) |
{ |
} |
@@ -56,6 +57,21 @@ void WaveShaperProcessor::setCurve(Float32Array* curve) |
m_curve = curve; |
} |
+void WaveShaperProcessor::setOversample(OverSampleType oversample) |
+{ |
+ // This synchronizes with process(). |
+ MutexLocker processLocker(m_processLock); |
+ |
+ m_oversample = oversample; |
+ |
+ if (oversample != OverSampleNone) { |
+ for (unsigned i = 0; i < m_kernels.size(); ++i) { |
+ WaveShaperDSPKernel* kernel = static_cast<WaveShaperDSPKernel*>(m_kernels[i].get()); |
+ kernel->lazyInitializeOversampling(); |
+ } |
+ } |
+} |
+ |
void WaveShaperProcessor::process(const AudioBus* source, AudioBus* destination, size_t framesToProcess) |
{ |
if (!isInitialized()) { |