summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortkent@chromium.org <tkent@chromium.org>2015-03-27 04:03:39 +0000
committertkent@chromium.org <tkent@chromium.org>2015-03-27 04:03:39 +0000
commitae15f45dabbbfe2dc43f0a691a7e0c43a8c8bf8d (patch)
tree4024f3441198fb28727f478a9f7589fbb5c4414a
parentb6a30f5fed8f0ca3cf2f2dc51d0d55d5f5f32254 (diff)
downloadchromium_src-ae15f45dabbbfe2dc43f0a691a7e0c43a8c8bf8d.zip
chromium_src-ae15f45dabbbfe2dc43f0a691a7e0c43a8c8bf8d.tar.gz
chromium_src-ae15f45dabbbfe2dc43f0a691a7e0c43a8c8bf8d.tar.bz2
Web Audio: Drop Oilpan from AudioParamHandler.
The main goal of this CL is to drop Oilapn from AudioParamHandler. We'd like to drop Oilpan from almost all of classes touched in an audio rendering thread, and AudioParamHandler is touched in an audio rendering thread. We still want to use Oilpan GC to manage AudioParam lifetime. So, this CL introduce AudioParam class to wrap AudioParamHandler, and AudioParam class is on Oilpan heap. This CL changes the representation of connection references. Before this CL, a connection from an AudioNode to an AudioParam is represented as: AudioNode | | HeapVector<Member<AudioNodeOutput>> m_outputs V AudioNodeOutput | | HeapHashSet<Member<AudioParam>> m_params V AudioParam After this CL: AudioNode | | HeapVector<Member<HeapHashSet<Member<AudioParam>>>> m_connectedParams V AudioParam and AudioNode | | HeapVector<Member<AudioNodeOutput>> m_outputs V AudioNodeOutput | | HashSet<AudioParamHandler*> m_params V AudioParamHandler We need two graphs described in the document on the bug. Note: Following patches will drop Oilpan from AudioNodeOutput. This CL adds annoying .handler() to existing code. Some of them are going to be removed again later. BUG=464617 R=haraken@chromium.org, rtoy@chromium.org Review URL: https://codereview.chromium.org/995423004 git-svn-id: svn://svn.chromium.org/blink/trunk@192649 bbb929c8-8fbe-4397-9dbb-9b2b20218538
-rw-r--r--third_party/WebKit/Source/modules/webaudio/AudioNode.cpp24
-rw-r--r--third_party/WebKit/Source/modules/webaudio/AudioNode.h12
-rw-r--r--third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.cpp9
-rw-r--r--third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.h12
-rw-r--r--third_party/WebKit/Source/modules/webaudio/AudioParam.cpp75
-rw-r--r--third_party/WebKit/Source/modules/webaudio/AudioParam.h81
-rw-r--r--third_party/WebKit/Source/modules/webaudio/AudioSummingJunction.h2
-rw-r--r--third_party/WebKit/Source/modules/webaudio/BiquadDSPKernel.cpp16
-rw-r--r--third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.h10
-rw-r--r--third_party/WebKit/Source/modules/webaudio/BiquadProcessor.cpp18
-rw-r--r--third_party/WebKit/Source/modules/webaudio/DelayDSPKernel.cpp6
-rw-r--r--third_party/WebKit/Source/modules/webaudio/GainNode.cpp4
-rw-r--r--third_party/WebKit/Source/modules/webaudio/OscillatorNode.cpp24
-rw-r--r--third_party/WebKit/Source/modules/webaudio/StereoPannerNode.cpp4
14 files changed, 194 insertions, 103 deletions
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp b/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp
index 0830455..cf1ad92 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AudioNode.cpp
@@ -176,6 +176,8 @@ void AudioNode::addInput()
void AudioNode::addOutput(unsigned numberOfChannels)
{
m_outputs.append(AudioNodeOutput::create(this, numberOfChannels));
+ m_connectedParams.append(nullptr);
+ ASSERT(numberOfOutputs() == m_connectedParams.size());
}
AudioNodeInput* AudioNode::input(unsigned i)
@@ -272,7 +274,10 @@ void AudioNode::connect(AudioParam* param, unsigned outputIndex, ExceptionState&
return;
}
- param->connect(*output(outputIndex));
+ param->handler().connect(*output(outputIndex));
+ if (!m_connectedParams[outputIndex])
+ m_connectedParams[outputIndex] = new HeapHashSet<Member<AudioParam>>();
+ m_connectedParams[outputIndex]->add(param);
}
void AudioNode::disconnect()
@@ -446,8 +451,9 @@ void AudioNode::disconnect(AudioParam* destinationParam, ExceptionState& excepti
// Disconnect if connected and increase |numberOfDisconnectios| by 1.
for (unsigned i = 0; i < numberOfOutputs(); ++i) {
AudioNodeOutput* output = this->output(i);
- if (output->isConnectedToAudioParam(*destinationParam)) {
- output->disconnectAudioParam(*destinationParam);
+ if (output->isConnectedToAudioParam(destinationParam->handler())) {
+ output->disconnectAudioParam(destinationParam->handler());
+ m_connectedParams[i]->remove(destinationParam);
numberOfDisconnections++;
}
}
@@ -473,14 +479,15 @@ void AudioNode::disconnect(AudioParam* destinationParam, unsigned outputIndex, E
AudioNodeOutput* output = this->output(outputIndex);
// Sanity check on the connection between the output and the destination.
- if (!output->isConnectedToAudioParam(*destinationParam)) {
+ if (!output->isConnectedToAudioParam(destinationParam->handler())) {
exceptionState.throwDOMException(
InvalidAccessError,
"specified destination AudioParam and node output (" + String::number(outputIndex) + ") are not connected.");
return;
}
- output->disconnectAudioParam(*destinationParam);
+ output->disconnectAudioParam(destinationParam->handler());
+ m_connectedParams[outputIndex]->remove(destinationParam);
} else {
// The output index is out of range. Throw an exception.
@@ -503,8 +510,10 @@ void AudioNode::disconnectWithoutException(unsigned outputIndex)
AudioContext::AutoLocker locker(context());
// Sanity check input and output indices.
- if (outputIndex < numberOfOutputs())
- output(outputIndex)->disconnectAll();
+ if (outputIndex >= numberOfOutputs())
+ return;
+ output(outputIndex)->disconnectAll();
+ m_connectedParams[outputIndex] = nullptr;
}
unsigned long AudioNode::channelCount()
@@ -810,6 +819,7 @@ DEFINE_TRACE(AudioNode)
visitor->trace(m_context);
visitor->trace(m_inputs);
visitor->trace(m_outputs);
+ visitor->trace(m_connectedParams);
RefCountedGarbageCollectedEventTargetWithInlineData<AudioNode>::trace(visitor);
}
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNode.h b/third_party/WebKit/Source/modules/webaudio/AudioNode.h
index feca3a5..e198364 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioNode.h
+++ b/third_party/WebKit/Source/modules/webaudio/AudioNode.h
@@ -40,7 +40,7 @@ namespace blink {
class AudioContext;
class AudioNodeInput;
class AudioNodeOutput;
-class AudioParamHandler;
+class AudioParam;
class ExceptionState;
// An AudioNode is the basic building block for handling audio within an AudioContext.
@@ -137,15 +137,15 @@ public:
// Called from main thread by corresponding JavaScript methods.
virtual void connect(AudioNode*, unsigned outputIndex, unsigned inputIndex, ExceptionState&);
- void connect(AudioParamHandler*, unsigned outputIndex, ExceptionState&);
+ void connect(AudioParam*, unsigned outputIndex, ExceptionState&);
virtual void disconnect();
virtual void disconnect(unsigned outputIndex, ExceptionState&);
virtual void disconnect(AudioNode*, ExceptionState&);
virtual void disconnect(AudioNode*, unsigned outputIndex, ExceptionState&);
virtual void disconnect(AudioNode*, unsigned outputIndex, unsigned inputIndex, ExceptionState&);
- virtual void disconnect(AudioParamHandler*, ExceptionState&);
- virtual void disconnect(AudioParamHandler*, unsigned outputIndex, ExceptionState&);
+ virtual void disconnect(AudioParam*, ExceptionState&);
+ virtual void disconnect(AudioParam*, unsigned outputIndex, ExceptionState&);
// Like disconnect, but no exception is thrown if the outputIndex is invalid. Just do nothing
// in that case.
@@ -232,6 +232,10 @@ private:
float m_sampleRate;
HeapVector<Member<AudioNodeInput>> m_inputs;
HeapVector<Member<AudioNodeOutput>> m_outputs;
+ // Represents audio node graph with Oilpan references. N-th HeapHashSet
+ // represents a set of AudioParam objects connected to this AudioNode's N-th
+ // output.
+ HeapVector<Member<HeapHashSet<Member<AudioParam>>>> m_connectedParams;
double m_lastProcessingTime;
double m_lastNonSilentTime;
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.cpp b/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.cpp
index 8a86b42..a0128bc 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.cpp
@@ -58,7 +58,6 @@ DEFINE_TRACE(AudioNodeOutput)
{
visitor->trace(m_node);
visitor->trace(m_inputs);
- visitor->trace(m_params);
}
void AudioNodeOutput::dispose()
@@ -196,19 +195,19 @@ void AudioNodeOutput::disconnectInput(AudioNodeInput& input)
input.disconnect(*this);
}
-void AudioNodeOutput::disconnectAudioParam(AudioParam& param)
+void AudioNodeOutput::disconnectAudioParam(AudioParamHandler& param)
{
ASSERT(context()->isGraphOwner() && isConnectedToAudioParam(param));
param.disconnect(*this);
}
-void AudioNodeOutput::addParam(AudioParam& param)
+void AudioNodeOutput::addParam(AudioParamHandler& param)
{
ASSERT(context()->isGraphOwner());
m_params.add(&param);
}
-void AudioNodeOutput::removeParam(AudioParam& param)
+void AudioNodeOutput::removeParam(AudioParamHandler& param)
{
ASSERT(context()->isGraphOwner());
m_params.remove(&param);
@@ -235,7 +234,7 @@ bool AudioNodeOutput::isConnectedToInput(AudioNodeInput& input)
return m_inputs.contains(&input);
}
-bool AudioNodeOutput::isConnectedToAudioParam(AudioParam& param)
+bool AudioNodeOutput::isConnectedToAudioParam(AudioParamHandler& param)
{
ASSERT(context()->isGraphOwner());
return m_params.contains(&param);
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.h b/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.h
index e68280c..e5787ae 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.h
+++ b/third_party/WebKit/Source/modules/webaudio/AudioNodeOutput.h
@@ -68,7 +68,7 @@ public:
// Disconnect a specific input or AudioParam.
void disconnectInput(AudioNodeInput &);
- void disconnectAudioParam(AudioParam &);
+ void disconnectAudioParam(AudioParamHandler&);
void setNumberOfChannels(unsigned);
unsigned numberOfChannels() const { return m_numberOfChannels; }
@@ -78,7 +78,7 @@ public:
// Probe if the output node is connected with a certain input or AudioParam
bool isConnectedToInput(AudioNodeInput &);
- bool isConnectedToAudioParam(AudioParam &);
+ bool isConnectedToAudioParam(AudioParamHandler&);
// Disable/Enable happens when there are still JavaScript references to a node, but it has otherwise "finished" its work.
// For example, when a note has finished playing. It is kept around, because it may be played again at a later time.
@@ -102,8 +102,8 @@ private:
// They must be called with the context's graph lock.
void addInput(AudioNodeInput&);
void removeInput(AudioNodeInput&);
- void addParam(AudioParam&);
- void removeParam(AudioParam&);
+ void addParam(AudioParamHandler&);
+ void removeParam(AudioParamHandler&);
// fanOutCount() is the number of AudioNodeInputs that we're connected to.
// This method should not be called in audio thread rendering code, instead renderingFanOutCount() should be used.
@@ -158,7 +158,9 @@ private:
unsigned m_renderingFanOutCount;
unsigned m_renderingParamFanOutCount;
- HeapHashSet<Member<AudioParam>> m_params;
+ // This collection of raw pointers is safe because they are retained by
+ // AudioParam objects referred in m_nextParams of the owner AudioNode.
+ HashSet<AudioParamHandler*> m_params;
};
} // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioParam.cpp b/third_party/WebKit/Source/modules/webaudio/AudioParam.cpp
index 611b9a9..b16cee4 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioParam.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AudioParam.cpp
@@ -38,6 +38,14 @@ namespace blink {
const double AudioParamHandler::DefaultSmoothingConstant = 0.05;
const double AudioParamHandler::SnapThreshold = 0.001;
+AudioContext* AudioParamHandler::context() const
+{
+ // TODO(tkent): We can remove this dangerous function by removing
+ // AudioContext dependency from AudioParamTimeline.
+ ASSERT_WITH_SECURITY_IMPLICATION(deferredTaskHandler().isAudioThread());
+ return &m_context;
+}
+
float AudioParamHandler::value()
{
// Update value for timeline.
@@ -184,15 +192,74 @@ void AudioParamHandler::disconnect(AudioNodeOutput& output)
}
}
-DEFINE_TRACE(AudioParamHandler)
+// ----------------------------------------------------------------
+
+AudioParam::AudioParam(AudioContext* context, double defaultValue)
+ : m_handler(AudioParamHandler::create(context, defaultValue))
+ , m_context(context)
+{
+}
+
+AudioParam* AudioParam::create(AudioContext* context, double defaultValue)
+{
+ ASSERT(context);
+ return new AudioParam(context, defaultValue);
+}
+
+DEFINE_TRACE(AudioParam)
{
visitor->trace(m_context);
// TODO(tkent): Oilpan: m_renderingOutputs should not be strong references.
// This is a short-term workaround to avoid crashes, and causes AudioNode
// leaks.
- AudioContext::AutoLocker locker(deferredTaskHandler());
- for (size_t i = 0; i < m_renderingOutputs.size(); ++i)
- visitor->trace(m_renderingOutputs[i]);
+ AudioContext::AutoLocker locker(context());
+ for (unsigned i = 0; i < handler().numberOfRenderingConnections(); ++i)
+ visitor->trace(handler().renderingOutput(i));
+}
+
+float AudioParam::value() const
+{
+ return handler().value();
+}
+
+void AudioParam::setValue(float value)
+{
+ handler().setValue(value);
+}
+
+float AudioParam::defaultValue() const
+{
+ return handler().defaultValue();
+}
+
+void AudioParam::setValueAtTime(float value, double time, ExceptionState& exceptionState)
+{
+ handler().timeline().setValueAtTime(value, time, exceptionState);
+}
+
+void AudioParam::linearRampToValueAtTime(float value, double time, ExceptionState& exceptionState)
+{
+ handler().timeline().linearRampToValueAtTime(value, time, exceptionState);
+}
+
+void AudioParam::exponentialRampToValueAtTime(float value, double time, ExceptionState& exceptionState)
+{
+ handler().timeline().exponentialRampToValueAtTime(value, time, exceptionState);
+}
+
+void AudioParam::setTargetAtTime(float target, double time, double timeConstant, ExceptionState& exceptionState)
+{
+ handler().timeline().setTargetAtTime(target, time, timeConstant, exceptionState);
+}
+
+void AudioParam::setValueCurveAtTime(DOMFloat32Array* curve, double time, double duration, ExceptionState& exceptionState)
+{
+ handler().timeline().setValueCurveAtTime(curve, time, duration, exceptionState);
+}
+
+void AudioParam::cancelScheduledValues(double startTime, ExceptionState& exceptionState)
+{
+ handler().timeline().cancelScheduledValues(startTime, exceptionState);
}
} // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioParam.h b/third_party/WebKit/Source/modules/webaudio/AudioParam.h
index 32b67be..3b89948 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioParam.h
+++ b/third_party/WebKit/Source/modules/webaudio/AudioParam.h
@@ -42,22 +42,30 @@ namespace blink {
class AudioNodeOutput;
-class AudioParamHandler final : public GarbageCollectedFinalized<AudioParamHandler>, public AudioSummingJunction, public ScriptWrappable {
- DEFINE_WRAPPERTYPEINFO();
+// AudioParamHandler is an actual implementation of web-exposed AudioParam
+// interface. Each of AudioParam object creates and owns an AudioParamHandler,
+// and it is responsible for all of AudioParam tasks. An AudioParamHandler
+// object is owned by the originator AudioParam object, and some audio
+// processing classes have additional references. An AudioParamHandler can
+// outlive the owner AudioParam, and it never dies before the owner AudioParam.
+class AudioParamHandler final : public ThreadSafeRefCounted<AudioParamHandler>, public AudioSummingJunction {
public:
static const double DefaultSmoothingConstant;
static const double SnapThreshold;
- static AudioParamHandler* create(AudioContext* context, double defaultValue)
+ static PassRefPtr<AudioParamHandler> create(AudioContext* context, double defaultValue)
{
- return new AudioParamHandler(context, defaultValue);
+ return adoptRef(new AudioParamHandler(context, defaultValue));
}
DECLARE_TRACE();
- AudioContext* context() const { return m_context; }
+ // This should be used only in audio rendering thread.
+ AudioContext* context() const;
// AudioSummingJunction
virtual void didUpdate() override { }
+ AudioParamTimeline& timeline() { return m_timeline; }
+
// Intrinsic value.
float value();
void setValue(float);
@@ -80,32 +88,6 @@ public:
void resetSmoothedValue() { m_smoothedValue = m_value; }
- // Parameter automation.
- void setValueAtTime(float value, double time, ExceptionState& exceptionState)
- {
- m_timeline.setValueAtTime(value, time, exceptionState);
- }
- void linearRampToValueAtTime(float value, double time, ExceptionState& exceptionState)
- {
- m_timeline.linearRampToValueAtTime(value, time, exceptionState);
- }
- void exponentialRampToValueAtTime(float value, double time, ExceptionState& es)
- {
- m_timeline.exponentialRampToValueAtTime(value, time, es);
- }
- void setTargetAtTime(float target, double time, double timeConstant, ExceptionState& exceptionState)
- {
- m_timeline.setTargetAtTime(target, time, timeConstant, exceptionState);
- }
- void setValueCurveAtTime(DOMFloat32Array* curve, double time, double duration, ExceptionState& exceptionState)
- {
- m_timeline.setValueCurveAtTime(curve, time, duration, exceptionState);
- }
- void cancelScheduledValues(double startTime, ExceptionState& exceptionState)
- {
- m_timeline.cancelScheduledValues(startTime, exceptionState);
- }
-
bool hasSampleAccurateValues() { return m_timeline.hasValues() || numberOfRenderingConnections(); }
// Calculates numberOfValues parameter values starting at the context's current time.
@@ -122,7 +104,7 @@ private:
, m_value(defaultValue)
, m_defaultValue(defaultValue)
, m_smoothedValue(defaultValue)
- , m_context(context) { }
+ , m_context(*context) { }
// sampleAccurate corresponds to a-rate (audio rate) vs. k-rate in the Web Audio specification.
void calculateFinalValues(float* values, unsigned numberOfValues, bool sampleAccurate);
@@ -135,12 +117,39 @@ private:
double m_smoothedValue;
AudioParamTimeline m_timeline;
- Member<AudioContext> m_context;
+
+ // We can't make this Persistent because of a reference cycle. It's safe to
+ // access this field only when we're rendering audio.
+ AudioContext& m_context;
};
-// TODO(tkent): remove the type alias, and introduce a real AudioParam class to
-// wrap AudioParamHandler.
-using AudioParam = AudioParamHandler;
+// AudioParam class represents web-exposed AudioParam interface.
+class AudioParam final : public GarbageCollectedFinalized<AudioParam>, public ScriptWrappable {
+ DEFINE_WRAPPERTYPEINFO();
+public:
+ static AudioParam* create(AudioContext*, double defaultValue);
+ DECLARE_TRACE();
+ // |handler| always returns a valid object.
+ AudioParamHandler& handler() const { return *m_handler; }
+ // |context| always returns a valid object.
+ AudioContext* context() const { return m_context; }
+
+ float value() const;
+ void setValue(float);
+ float defaultValue() const;
+ void setValueAtTime(float value, double time, ExceptionState&);
+ void linearRampToValueAtTime(float value, double time, ExceptionState&);
+ void exponentialRampToValueAtTime(float value, double time, ExceptionState&);
+ void setTargetAtTime(float target, double time, double timeConstant, ExceptionState&);
+ void setValueCurveAtTime(DOMFloat32Array* curve, double time, double duration, ExceptionState&);
+ void cancelScheduledValues(double startTime, ExceptionState&);
+
+private:
+ AudioParam(AudioContext*, double defaultValue);
+
+ RefPtr<AudioParamHandler> m_handler;
+ Member<AudioContext> m_context;
+};
} // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioSummingJunction.h b/third_party/WebKit/Source/modules/webaudio/AudioSummingJunction.h
index f9a3410..8c7b81a 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioSummingJunction.h
+++ b/third_party/WebKit/Source/modules/webaudio/AudioSummingJunction.h
@@ -42,7 +42,7 @@ public:
virtual ~AudioSummingJunction();
// Can be called from any thread.
- DeferredTaskHandler& deferredTaskHandler() { return *m_deferredTaskHandler; }
+ DeferredTaskHandler& deferredTaskHandler() const { return *m_deferredTaskHandler; }
// This must be called whenever we modify m_outputs.
void changedOutputs();
diff --git a/third_party/WebKit/Source/modules/webaudio/BiquadDSPKernel.cpp b/third_party/WebKit/Source/modules/webaudio/BiquadDSPKernel.cpp
index 02c61fb..e0b6e6c 100644
--- a/third_party/WebKit/Source/modules/webaudio/BiquadDSPKernel.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/BiquadDSPKernel.cpp
@@ -47,15 +47,15 @@ void BiquadDSPKernel::updateCoefficientsIfNecessary()
double detune; // in Cents
if (biquadProcessor()->hasSampleAccurateValues()) {
- cutoffFrequency = biquadProcessor()->parameter1()->finalValue();
- Q = biquadProcessor()->parameter2()->finalValue();
- gain = biquadProcessor()->parameter3()->finalValue();
- detune = biquadProcessor()->parameter4()->finalValue();
+ cutoffFrequency = biquadProcessor()->parameter1()->handler().finalValue();
+ Q = biquadProcessor()->parameter2()->handler().finalValue();
+ gain = biquadProcessor()->parameter3()->handler().finalValue();
+ detune = biquadProcessor()->parameter4()->handler().finalValue();
} else {
- cutoffFrequency = biquadProcessor()->parameter1()->smoothedValue();
- Q = biquadProcessor()->parameter2()->smoothedValue();
- gain = biquadProcessor()->parameter3()->smoothedValue();
- detune = biquadProcessor()->parameter4()->smoothedValue();
+ cutoffFrequency = biquadProcessor()->parameter1()->handler().smoothedValue();
+ Q = biquadProcessor()->parameter2()->handler().smoothedValue();
+ gain = biquadProcessor()->parameter3()->handler().smoothedValue();
+ detune = biquadProcessor()->parameter4()->handler().smoothedValue();
}
updateCoefficients(cutoffFrequency, Q, gain, detune);
diff --git a/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.h b/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.h
index 8d3cba591..2c5f076 100644
--- a/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.h
+++ b/third_party/WebKit/Source/modules/webaudio/BiquadFilterNode.h
@@ -31,7 +31,7 @@
namespace blink {
-class AudioParamHandler;
+class AudioParam;
class BiquadFilterNode final : public AudioBasicProcessorNode {
DEFINE_WRAPPERTYPEINFO();
@@ -56,10 +56,10 @@ public:
String type() const;
void setType(const String&);
- AudioParamHandler* frequency() { return biquadProcessor()->parameter1(); }
- AudioParamHandler* q() { return biquadProcessor()->parameter2(); }
- AudioParamHandler* gain() { return biquadProcessor()->parameter3(); }
- AudioParamHandler* detune() { return biquadProcessor()->parameter4(); }
+ AudioParam* frequency() { return biquadProcessor()->parameter1(); }
+ AudioParam* q() { return biquadProcessor()->parameter2(); }
+ AudioParam* gain() { return biquadProcessor()->parameter3(); }
+ AudioParam* detune() { return biquadProcessor()->parameter4(); }
// Get the magnitude and phase response of the filter at the given
// set of frequencies (in Hz). The phase response is in radians.
diff --git a/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.cpp b/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.cpp
index f86d159..94f71f4 100644
--- a/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/BiquadProcessor.cpp
@@ -78,24 +78,24 @@ void BiquadProcessor::checkForDirtyCoefficients()
m_filterCoefficientsDirty = false;
m_hasSampleAccurateValues = false;
- if (m_parameter1->hasSampleAccurateValues() || m_parameter2->hasSampleAccurateValues() || m_parameter3->hasSampleAccurateValues() || m_parameter4->hasSampleAccurateValues()) {
+ if (m_parameter1->handler().hasSampleAccurateValues() || m_parameter2->handler().hasSampleAccurateValues() || m_parameter3->handler().hasSampleAccurateValues() || m_parameter4->handler().hasSampleAccurateValues()) {
m_filterCoefficientsDirty = true;
m_hasSampleAccurateValues = true;
} else {
if (m_hasJustReset) {
// Snap to exact values first time after reset, then smooth for subsequent changes.
- m_parameter1->resetSmoothedValue();
- m_parameter2->resetSmoothedValue();
- m_parameter3->resetSmoothedValue();
- m_parameter4->resetSmoothedValue();
+ m_parameter1->handler().resetSmoothedValue();
+ m_parameter2->handler().resetSmoothedValue();
+ m_parameter3->handler().resetSmoothedValue();
+ m_parameter4->handler().resetSmoothedValue();
m_filterCoefficientsDirty = true;
m_hasJustReset = false;
} else {
// Smooth all of the filter parameters. If they haven't yet converged to their target value then mark coefficients as dirty.
- bool isStable1 = m_parameter1->smooth();
- bool isStable2 = m_parameter2->smooth();
- bool isStable3 = m_parameter3->smooth();
- bool isStable4 = m_parameter4->smooth();
+ bool isStable1 = m_parameter1->handler().smooth();
+ bool isStable2 = m_parameter2->handler().smooth();
+ bool isStable3 = m_parameter3->handler().smooth();
+ bool isStable4 = m_parameter4->handler().smooth();
if (!(isStable1 && isStable2 && isStable3 && isStable4))
m_filterCoefficientsDirty = true;
}
diff --git a/third_party/WebKit/Source/modules/webaudio/DelayDSPKernel.cpp b/third_party/WebKit/Source/modules/webaudio/DelayDSPKernel.cpp
index 26e15e8..376504e 100644
--- a/third_party/WebKit/Source/modules/webaudio/DelayDSPKernel.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/DelayDSPKernel.cpp
@@ -56,17 +56,17 @@ DelayDSPKernel::DelayDSPKernel(DelayProcessor* processor)
bool DelayDSPKernel::hasSampleAccurateValues()
{
- return delayProcessor()->delayTime()->hasSampleAccurateValues();
+ return delayProcessor()->delayTime()->handler().hasSampleAccurateValues();
}
void DelayDSPKernel::calculateSampleAccurateValues(float* delayTimes, size_t framesToProcess)
{
- delayProcessor()->delayTime()->calculateSampleAccurateValues(delayTimes, framesToProcess);
+ delayProcessor()->delayTime()->handler().calculateSampleAccurateValues(delayTimes, framesToProcess);
}
double DelayDSPKernel::delayTime(float)
{
- return delayProcessor()->delayTime()->finalValue();
+ return delayProcessor()->delayTime()->handler().finalValue();
}
} // namespace blink
diff --git a/third_party/WebKit/Source/modules/webaudio/GainNode.cpp b/third_party/WebKit/Source/modules/webaudio/GainNode.cpp
index 3da6aae..f7c9225 100644
--- a/third_party/WebKit/Source/modules/webaudio/GainNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/GainNode.cpp
@@ -59,12 +59,12 @@ void GainNode::process(size_t framesToProcess)
} else {
AudioBus* inputBus = input(0)->bus();
- if (gain()->hasSampleAccurateValues()) {
+ if (gain()->handler().hasSampleAccurateValues()) {
// Apply sample-accurate gain scaling for precise envelopes, grain windows, etc.
ASSERT(framesToProcess <= m_sampleAccurateGainValues.size());
if (framesToProcess <= m_sampleAccurateGainValues.size()) {
float* gainValues = m_sampleAccurateGainValues.data();
- gain()->calculateSampleAccurateValues(gainValues, framesToProcess);
+ gain()->handler().calculateSampleAccurateValues(gainValues, framesToProcess);
outputBus->copyWithSampleAccurateGainValuesFrom(*inputBus, gainValues, framesToProcess);
}
} else {
diff --git a/third_party/WebKit/Source/modules/webaudio/OscillatorNode.cpp b/third_party/WebKit/Source/modules/webaudio/OscillatorNode.cpp
index 57ace58..97b32e6 100644
--- a/third_party/WebKit/Source/modules/webaudio/OscillatorNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/OscillatorNode.cpp
@@ -155,8 +155,8 @@ bool OscillatorNode::calculateSampleAccuratePhaseIncrements(size_t framesToProce
if (m_firstRender) {
m_firstRender = false;
- m_frequency->resetSmoothedValue();
- m_detune->resetSmoothedValue();
+ m_frequency->handler().resetSmoothedValue();
+ m_detune->handler().resetSmoothedValue();
}
bool hasSampleAccurateValues = false;
@@ -165,26 +165,26 @@ bool OscillatorNode::calculateSampleAccuratePhaseIncrements(size_t framesToProce
float finalScale = m_periodicWave->rateScale();
- if (m_frequency->hasSampleAccurateValues()) {
+ if (m_frequency->handler().hasSampleAccurateValues()) {
hasSampleAccurateValues = true;
hasFrequencyChanges = true;
// Get the sample-accurate frequency values and convert to phase increments.
// They will be converted to phase increments below.
- m_frequency->calculateSampleAccurateValues(phaseIncrements, framesToProcess);
+ m_frequency->handler().calculateSampleAccurateValues(phaseIncrements, framesToProcess);
} else {
// Handle ordinary parameter smoothing/de-zippering if there are no scheduled changes.
- m_frequency->smooth();
- float frequency = m_frequency->smoothedValue();
+ m_frequency->handler().smooth();
+ float frequency = m_frequency->handler().smoothedValue();
finalScale *= frequency;
}
- if (m_detune->hasSampleAccurateValues()) {
+ if (m_detune->handler().hasSampleAccurateValues()) {
hasSampleAccurateValues = true;
// Get the sample-accurate detune values.
float* detuneValues = hasFrequencyChanges ? m_detuneValues.data() : phaseIncrements;
- m_detune->calculateSampleAccurateValues(detuneValues, framesToProcess);
+ m_detune->handler().calculateSampleAccurateValues(detuneValues, framesToProcess);
// Convert from cents to rate scalar.
float k = 1.0 / 1200;
@@ -198,8 +198,8 @@ bool OscillatorNode::calculateSampleAccuratePhaseIncrements(size_t framesToProce
}
} else {
// Handle ordinary parameter smoothing/de-zippering if there are no scheduled changes.
- m_detune->smooth();
- float detune = m_detune->smoothedValue();
+ m_detune->handler().smooth();
+ float detune = m_detune->handler().smoothedValue();
float detuneScale = powf(2, detune / 1200);
finalScale *= detuneScale;
}
@@ -269,8 +269,8 @@ void OscillatorNode::process(size_t framesToProcess)
float tableInterpolationFactor = 0;
if (!hasSampleAccurateValues) {
- frequency = m_frequency->smoothedValue();
- float detune = m_detune->smoothedValue();
+ frequency = m_frequency->handler().smoothedValue();
+ float detune = m_detune->handler().smoothedValue();
float detuneScale = powf(2, detune / 1200);
frequency *= detuneScale;
m_periodicWave->waveDataForFundamentalFrequency(frequency, lowerWaveData, higherWaveData, tableInterpolationFactor);
diff --git a/third_party/WebKit/Source/modules/webaudio/StereoPannerNode.cpp b/third_party/WebKit/Source/modules/webaudio/StereoPannerNode.cpp
index b5bfc88..32a057c 100644
--- a/third_party/WebKit/Source/modules/webaudio/StereoPannerNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/StereoPannerNode.cpp
@@ -62,12 +62,12 @@ void StereoPannerNode::process(size_t framesToProcess)
return;
}
- if (pan()->hasSampleAccurateValues()) {
+ if (pan()->handler().hasSampleAccurateValues()) {
// Apply sample-accurate panning specified by AudioParam automation.
ASSERT(framesToProcess <= m_sampleAccuratePanValues.size());
if (framesToProcess <= m_sampleAccuratePanValues.size()) {
float* panValues = m_sampleAccuratePanValues.data();
- pan()->calculateSampleAccurateValues(panValues, framesToProcess);
+ pan()->handler().calculateSampleAccurateValues(panValues, framesToProcess);
m_stereoPanner->panWithSampleAccurateValues(inputBus, outputBus, panValues, framesToProcess);
}
} else {