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

Unified Diff: third_party/WebKit/Source/modules/webaudio/ConvolverNode.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/ConvolverNode.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp b/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp
index 70054e847f5591d88ca46530f79bbe8d215b3083..9c52399a5141620a9dac21c758055eb0765f25c4 100644
--- a/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp
@@ -28,6 +28,7 @@
#include "modules/webaudio/AudioNodeInput.h"
#include "modules/webaudio/AudioNodeOutput.h"
#include "modules/webaudio/ConvolverNode.h"
+#include "modules/webaudio/ConvolverOptions.h"
#include "platform/audio/Reverb.h"
#include "wtf/PtrUtil.h"
#include <memory>
@@ -185,6 +186,23 @@ ConvolverNode* ConvolverNode::create(BaseAudioContext& context, ExceptionState&
return new ConvolverNode(context);
}
+ConvolverNode* ConvolverNode::create(BaseAudioContext* context, const ConvolverOptions& options, ExceptionState& exceptionState)
+{
+ ConvolverNode* node = create(*context, exceptionState);
+
+ if (!node)
+ return nullptr;
+
+ node->handleChannelOptions(options, exceptionState);
+
+ // It is important to set normalize first because setting the buffer will
+ // examing the normalize attribute to see if normalization needs to be done.
+ node->setNormalize(!options.disableNormalization());
+ if (options.hasBuffer())
+ node->setBuffer(options.buffer(), exceptionState);
+ return node;
+}
+
ConvolverHandler& ConvolverNode::convolverHandler() const
{
return static_cast<ConvolverHandler&>(handler());

Powered by Google App Engine
This is Rietveld 408576698