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

Unified Diff: third_party/WebKit/Source/modules/webaudio/GainNode.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/GainNode.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/GainNode.cpp b/third_party/WebKit/Source/modules/webaudio/GainNode.cpp
index 190e61a54f713778a7dcb6c924c56d9dbe1af6c0..7f026769d2c3825cc433ab2c9408261899d2a5ff 100644
--- a/third_party/WebKit/Source/modules/webaudio/GainNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/GainNode.cpp
@@ -25,6 +25,7 @@
#include "modules/webaudio/GainNode.h"
#include "modules/webaudio/AudioNodeInput.h"
#include "modules/webaudio/AudioNodeOutput.h"
+#include "modules/webaudio/GainOptions.h"
#include "platform/audio/AudioBus.h"
namespace blink {
@@ -138,6 +139,21 @@ GainNode* GainNode::create(BaseAudioContext& context, ExceptionState& exceptionS
return new GainNode(context);
}
+GainNode* GainNode::create(BaseAudioContext* context, const GainOptions& options, ExceptionState& exceptionState)
+{
+ GainNode* node = create(*context, exceptionState);
+
+ if (!node)
+ return nullptr;
+
+ node->handleChannelOptions(options, exceptionState);
+
+ if (options.hasGain())
+ node->gain()->setValue(options.gain());
+
+ return node;
+}
+
AudioParam* GainNode::gain() const
{
return m_gain;
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/GainNode.h ('k') | third_party/WebKit/Source/modules/webaudio/GainNode.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698