Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Unified Diff: third_party/WebKit/Source/modules/webaudio/PannerNode.cpp

Issue 2102133002: Add constructors for WebAudio nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and prefix use counter names with WebAudio Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webaudio/PannerNode.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/PannerNode.cpp b/third_party/WebKit/Source/modules/webaudio/PannerNode.cpp
index ce21afd7e6b0ca8c0f27e12a17ee87462540c536..d72172a97f86b231e9f3134ad586ab3c0cca650d 100644
--- a/third_party/WebKit/Source/modules/webaudio/PannerNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/PannerNode.cpp
@@ -31,6 +31,7 @@
#include "modules/webaudio/AudioNodeInput.h"
#include "modules/webaudio/AudioNodeOutput.h"
#include "modules/webaudio/BaseAudioContext.h"
+#include "modules/webaudio/PannerOptions.h"
#include "platform/Histogram.h"
#include "platform/audio/HRTFPanner.h"
#include "wtf/MathExtras.h"
@@ -668,6 +669,50 @@ PannerNode* PannerNode::create(BaseAudioContext& context, ExceptionState& except
return new PannerNode(context);
}
+PannerNode* PannerNode::create(BaseAudioContext* context, const PannerOptions& options, ExceptionState& exceptionState)
+{
+ PannerNode* node = create(*context, exceptionState);
+
+ if (!node)
+ return nullptr;
+
+ node->handleChannelOptions(options, exceptionState);
+
+ if (options.hasPanningModel())
+ node->setPanningModel(options.panningModel());
+ if (options.hasDistanceModel())
+ node->setDistanceModel(options.distanceModel());
+
+ if (options.hasPositionX())
+ node->positionX()->setValue(options.positionX());
+ if (options.hasPositionY())
+ node->positionY()->setValue(options.positionY());
+ if (options.hasPositionZ())
+ node->positionZ()->setValue(options.positionZ());
+
+ if (options.hasOrientationX())
+ node->orientationX()->setValue(options.orientationX());
+ if (options.hasOrientationY())
+ node->orientationY()->setValue(options.orientationY());
+ if (options.hasOrientationZ())
+ node->orientationZ()->setValue(options.orientationZ());
+
+ if (options.hasRefDistance())
+ node->setRefDistance(options.refDistance());
+ if (options.hasMaxDistance())
+ node->setMaxDistance(options.maxDistance());
+ if (options.hasRolloffFactor())
+ node->setRolloffFactor(options.rolloffFactor());
+ if (options.hasConeInnerAngle())
+ node->setConeInnerAngle(options.coneInnerAngle());
+ if (options.hasConeOuterAngle())
+ node->setConeOuterAngle(options.coneOuterAngle());
+ if (options.hasConeOuterGain())
+ node->setConeOuterGain(options.coneOuterGain());
+
+ return node;
+}
+
PannerHandler& PannerNode::pannerHandler() const
{
return static_cast<PannerHandler&>(handler());
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/PannerNode.h ('k') | third_party/WebKit/Source/modules/webaudio/PannerNode.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698