diff --git a/dom/media/webaudio/AudioBufferSourceNode.cpp b/dom/media/webaudio/AudioBufferSourceNode.cpp index 1b0d43cb1bb..3a09d4152d4 100644 --- a/dom/media/webaudio/AudioBufferSourceNode.cpp +++ b/dom/media/webaudio/AudioBufferSourceNode.cpp @@ -558,8 +558,8 @@ AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* aContext) , mLoopStart(0.0) , mLoopEnd(0.0) // mOffset and mDuration are initialized in Start(). - , mPlaybackRate(new AudioParam(this, SendPlaybackRateToStream, 1.0f)) - , mDetune(new AudioParam(this, SendDetuneToStream, 0.0f)) + , mPlaybackRate(new AudioParam(this, SendPlaybackRateToStream, 1.0f, "playbackRate")) + , mDetune(new AudioParam(this, SendDetuneToStream, 0.0f, "detune")) , mLoop(false) , mStartCalled(false) , mStopped(false) diff --git a/dom/media/webaudio/AudioParam.cpp b/dom/media/webaudio/AudioParam.cpp index 8aea9040298..10ed9302558 100644 --- a/dom/media/webaudio/AudioParam.cpp +++ b/dom/media/webaudio/AudioParam.cpp @@ -45,11 +45,13 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AudioParam, Release) AudioParam::AudioParam(AudioNode* aNode, AudioParam::CallbackType aCallback, - float aDefaultValue) + float aDefaultValue, + const char* aName) : AudioParamTimeline(aDefaultValue) , mNode(aNode) , mCallback(aCallback) , mDefaultValue(aDefaultValue) + , mName(aName) { } diff --git a/dom/media/webaudio/AudioParam.h b/dom/media/webaudio/AudioParam.h index 2e5b6f5c1d3..4b153121e34 100644 --- a/dom/media/webaudio/AudioParam.h +++ b/dom/media/webaudio/AudioParam.h @@ -30,7 +30,8 @@ public: AudioParam(AudioNode* aNode, CallbackType aCallback, - float aDefaultValue); + float aDefaultValue, + const char* aName); NS_IMETHOD_(MozExternalRefCountType) AddRef(void); NS_IMETHOD_(MozExternalRefCountType) Release(void); @@ -121,6 +122,16 @@ public: mCallback(mNode); } + uint32_t ParentNodeId() + { + return mNode->Id(); + } + + void GetName(nsAString& aName) + { + aName.AssignASCII(mName); + } + float DefaultValue() const { return mDefaultValue; @@ -183,6 +194,7 @@ private: nsTArray mInputNodes; CallbackType mCallback; const float mDefaultValue; + const char* mName; // The input port used to connect the AudioParam's stream to its node's stream nsRefPtr mNodeStreamPort; }; diff --git a/dom/media/webaudio/BiquadFilterNode.cpp b/dom/media/webaudio/BiquadFilterNode.cpp index 3e6341a9d7d..3b9ca2fbb23 100644 --- a/dom/media/webaudio/BiquadFilterNode.cpp +++ b/dom/media/webaudio/BiquadFilterNode.cpp @@ -244,10 +244,10 @@ BiquadFilterNode::BiquadFilterNode(AudioContext* aContext) ChannelCountMode::Max, ChannelInterpretation::Speakers) , mType(BiquadFilterType::Lowpass) - , mFrequency(new AudioParam(this, SendFrequencyToStream, 350.f)) - , mDetune(new AudioParam(this, SendDetuneToStream, 0.f)) - , mQ(new AudioParam(this, SendQToStream, 1.f)) - , mGain(new AudioParam(this, SendGainToStream, 0.f)) + , mFrequency(new AudioParam(this, SendFrequencyToStream, 350.f, "frequency")) + , mDetune(new AudioParam(this, SendDetuneToStream, 0.f, "detune")) + , mQ(new AudioParam(this, SendQToStream, 1.f, "Q")) + , mGain(new AudioParam(this, SendGainToStream, 0.f, "gain")) { BiquadFilterNodeEngine* engine = new BiquadFilterNodeEngine(this, aContext->Destination()); mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM); diff --git a/dom/media/webaudio/DelayNode.cpp b/dom/media/webaudio/DelayNode.cpp index 76b71203e38..b983a84c481 100644 --- a/dom/media/webaudio/DelayNode.cpp +++ b/dom/media/webaudio/DelayNode.cpp @@ -190,7 +190,7 @@ DelayNode::DelayNode(AudioContext* aContext, double aMaxDelay) 2, ChannelCountMode::Max, ChannelInterpretation::Speakers) - , mDelay(new AudioParam(this, SendDelayToStream, 0.0f)) + , mDelay(new AudioParam(this, SendDelayToStream, 0.0f, "delayTime")) { DelayNodeEngine* engine = new DelayNodeEngine(this, aContext->Destination(), diff --git a/dom/media/webaudio/DynamicsCompressorNode.cpp b/dom/media/webaudio/DynamicsCompressorNode.cpp index 5cc6fbd2c60..a6b874f5bdc 100644 --- a/dom/media/webaudio/DynamicsCompressorNode.cpp +++ b/dom/media/webaudio/DynamicsCompressorNode.cpp @@ -201,12 +201,12 @@ DynamicsCompressorNode::DynamicsCompressorNode(AudioContext* aContext) 2, ChannelCountMode::Explicit, ChannelInterpretation::Speakers) - , mThreshold(new AudioParam(this, SendThresholdToStream, -24.f)) - , mKnee(new AudioParam(this, SendKneeToStream, 30.f)) - , mRatio(new AudioParam(this, SendRatioToStream, 12.f)) + , mThreshold(new AudioParam(this, SendThresholdToStream, -24.f, "threshold")) + , mKnee(new AudioParam(this, SendKneeToStream, 30.f, "knee")) + , mRatio(new AudioParam(this, SendRatioToStream, 12.f, "ratio")) , mReduction(0) - , mAttack(new AudioParam(this, SendAttackToStream, 0.003f)) - , mRelease(new AudioParam(this, SendReleaseToStream, 0.25f)) + , mAttack(new AudioParam(this, SendAttackToStream, 0.003f, "attack")) + , mRelease(new AudioParam(this, SendReleaseToStream, 0.25f, "release")) { DynamicsCompressorNodeEngine* engine = new DynamicsCompressorNodeEngine(this, aContext->Destination()); mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM); diff --git a/dom/media/webaudio/GainNode.cpp b/dom/media/webaudio/GainNode.cpp index 729f9619f97..bf685f1cfad 100644 --- a/dom/media/webaudio/GainNode.cpp +++ b/dom/media/webaudio/GainNode.cpp @@ -125,7 +125,7 @@ GainNode::GainNode(AudioContext* aContext) 2, ChannelCountMode::Max, ChannelInterpretation::Speakers) - , mGain(new AudioParam(this, SendGainToStream, 1.0f)) + , mGain(new AudioParam(this, SendGainToStream, 1.0f, "gain")) { GainNodeEngine* engine = new GainNodeEngine(this, aContext->Destination()); mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM); diff --git a/dom/media/webaudio/OscillatorNode.cpp b/dom/media/webaudio/OscillatorNode.cpp index c101ba7c33a..e800c6d6520 100644 --- a/dom/media/webaudio/OscillatorNode.cpp +++ b/dom/media/webaudio/OscillatorNode.cpp @@ -381,8 +381,8 @@ OscillatorNode::OscillatorNode(AudioContext* aContext) ChannelCountMode::Max, ChannelInterpretation::Speakers) , mType(OscillatorType::Sine) - , mFrequency(new AudioParam(this, SendFrequencyToStream, 440.0f)) - , mDetune(new AudioParam(this, SendDetuneToStream, 0.0f)) + , mFrequency(new AudioParam(this, SendFrequencyToStream, 440.0f, "frequency")) + , mDetune(new AudioParam(this, SendDetuneToStream, 0.0f, "detune")) , mStartCalled(false) , mStopped(false) { diff --git a/dom/media/webaudio/StereoPannerNode.cpp b/dom/media/webaudio/StereoPannerNode.cpp index 3b00d41b0c7..41725160746 100644 --- a/dom/media/webaudio/StereoPannerNode.cpp +++ b/dom/media/webaudio/StereoPannerNode.cpp @@ -176,7 +176,7 @@ StereoPannerNode::StereoPannerNode(AudioContext* aContext) 2, ChannelCountMode::Clamped_max, ChannelInterpretation::Speakers) - , mPan(new AudioParam(this, SendPanToStream, 0.f)) + , mPan(new AudioParam(this, SendPanToStream, 0.f, "pan")) { StereoPannerNodeEngine* engine = new StereoPannerNodeEngine(this, aContext->Destination()); mStream = aContext->Graph()->CreateAudioNodeStream(engine, diff --git a/dom/media/webaudio/test/chrome.ini b/dom/media/webaudio/test/chrome.ini index 4de3332be8b..035b1a405c3 100644 --- a/dom/media/webaudio/test/chrome.ini +++ b/dom/media/webaudio/test/chrome.ini @@ -2,3 +2,4 @@ skip-if = buildapp == 'b2g' [test_AudioNodeDevtoolsAPI.html] +[test_AudioParamDevtoolsAPI.html] diff --git a/dom/media/webaudio/test/test_AudioParamDevtoolsAPI.html b/dom/media/webaudio/test/test_AudioParamDevtoolsAPI.html new file mode 100644 index 00000000000..f859277307e --- /dev/null +++ b/dom/media/webaudio/test/test_AudioParamDevtoolsAPI.html @@ -0,0 +1,48 @@ + + + + Test the devtool AudioParam API + + + + +
+
+
+ + diff --git a/dom/webidl/AudioParam.webidl b/dom/webidl/AudioParam.webidl index 375ab62791c..e5b53a2dc50 100644 --- a/dom/webidl/AudioParam.webidl +++ b/dom/webidl/AudioParam.webidl @@ -37,3 +37,13 @@ interface AudioParam { void cancelScheduledValues(double startTime); }; + +// Mozilla extension +partial interface AudioParam { + // The ID of the AudioNode this AudioParam belongs to. + [ChromeOnly] + readonly attribute unsigned long parentNodeId; + // The name of the AudioParam + [ChromeOnly] + readonly attribute DOMString name; +};