Bug 849916 - Part 2: Add helper functions for sending different argument types to the AudioNodeStream; r=padenot

This commit is contained in:
Ehsan Akhgari 2013-03-12 11:28:14 -04:00
parent 1fc3470bd9
commit b17f67da6a
2 changed files with 31 additions and 0 deletions

View File

@ -175,6 +175,30 @@ AudioNode::Connect(AudioNode& aDestination, uint32_t aOutput,
} }
} }
void
AudioNode::SendDoubleParameterToStream(uint32_t aIndex, double aValue)
{
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
MOZ_ASSERT(ns, "How come we don't have a stream here?");
ns->SetDoubleParameter(aIndex, aValue);
}
void
AudioNode::SendInt32ParameterToStream(uint32_t aIndex, int32_t aValue)
{
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
MOZ_ASSERT(ns, "How come we don't have a stream here?");
ns->SetInt32Parameter(aIndex, aValue);
}
void
AudioNode::SendThreeDPointParameterToStream(uint32_t aIndex, const ThreeDPoint& aValue)
{
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
MOZ_ASSERT(ns, "How come we don't have a stream here?");
ns->SetThreeDPointParameter(aIndex, aValue);
}
void void
AudioNode::Disconnect(uint32_t aOutput, ErrorResult& aRv) AudioNode::Disconnect(uint32_t aOutput, ErrorResult& aRv)
{ {

View File

@ -23,6 +23,8 @@ class ErrorResult;
namespace dom { namespace dom {
struct ThreeDPoint;
/** /**
* The DOM object representing a Web Audio AudioNode. * The DOM object representing a Web Audio AudioNode.
* *
@ -135,6 +137,11 @@ public:
protected: protected:
static void Callback(AudioNode* aNode) { /* not implemented */ } static void Callback(AudioNode* aNode) { /* not implemented */ }
// Helpers for sending different value types to streams
void SendDoubleParameterToStream(uint32_t aIndex, double aValue);
void SendInt32ParameterToStream(uint32_t aIndex, int32_t aValue);
void SendThreeDPointParameterToStream(uint32_t aIndex, const ThreeDPoint& aValue);
private: private:
nsRefPtr<AudioContext> mContext; nsRefPtr<AudioContext> mContext;