Bug 856328 - Part 1: Refactor sending an AudioParamTimeline to the stream into an AudioNode helper; r=padenot

--HG--
extra : rebase_source : 8e2331ded7c35d1a6e9057c5be5ad31a959beed9
This commit is contained in:
Ehsan Akhgari 2013-03-29 18:46:03 -07:00
parent 86ed2f4bb4
commit 94d6e8730d
3 changed files with 13 additions and 2 deletions

View File

@ -199,6 +199,15 @@ AudioNode::SendThreeDPointParameterToStream(uint32_t aIndex, const ThreeDPoint&
ns->SetThreeDPointParameter(aIndex, aValue);
}
void
AudioNode::SendTimelineParameterToStream(AudioNode* aNode, uint32_t aIndex,
const AudioParamTimeline& aValue)
{
AudioNodeStream* ns = static_cast<AudioNodeStream*>(aNode->mStream.get());
MOZ_ASSERT(ns, "How come we don't have a stream here?");
ns->SetTimelineParameter(aIndex, aValue);
}
void
AudioNode::Disconnect(uint32_t aOutput, ErrorResult& aRv)
{

View File

@ -13,6 +13,7 @@
#include "nsAutoPtr.h"
#include "nsTArray.h"
#include "AudioContext.h"
#include "AudioParamTimeline.h"
#include "MediaStreamGraph.h"
struct JSContext;
@ -141,6 +142,8 @@ protected:
void SendDoubleParameterToStream(uint32_t aIndex, double aValue);
void SendInt32ParameterToStream(uint32_t aIndex, int32_t aValue);
void SendThreeDPointParameterToStream(uint32_t aIndex, const ThreeDPoint& aValue);
static void SendTimelineParameterToStream(AudioNode* aNode, uint32_t aIndex,
const AudioParamTimeline& aValue);
private:
nsRefPtr<AudioContext> mContext;

View File

@ -117,8 +117,7 @@ void
GainNode::SendGainToStream(AudioNode* aNode)
{
GainNode* This = static_cast<GainNode*>(aNode);
AudioNodeStream* ns = static_cast<AudioNodeStream*>(This->mStream.get());
ns->SetTimelineParameter(GainNodeEngine::GAIN, *This->mGain);
SendTimelineParameterToStream(This, GainNodeEngine::GAIN, *This->mGain);
}
}