Chromium Code Reviews| Index: third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp |
| diff --git a/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp b/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp |
| index 24af794c3037d5967eea07a07b0568ca491d7ff4..728d2e656b2507a5eaaab8e63e77d23e08da66fb 100644 |
| --- a/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp |
| +++ b/third_party/WebKit/Source/modules/webaudio/AudioBufferSourceNode.cpp |
| @@ -27,6 +27,7 @@ |
| #include "core/dom/ExceptionCode.h" |
| #include "core/frame/UseCounter.h" |
| #include "modules/webaudio/AudioBufferSourceNode.h" |
| +#include "modules/webaudio/AudioBufferSourceOptions.h" |
| #include "modules/webaudio/AudioNodeOutput.h" |
| #include "modules/webaudio/BaseAudioContext.h" |
| #include "platform/FloatConversion.h" |
| @@ -614,6 +615,29 @@ AudioBufferSourceNode* AudioBufferSourceNode::create(BaseAudioContext& context, |
| return new AudioBufferSourceNode(context); |
| } |
| +AudioBufferSourceNode* AudioBufferSourceNode::create(BaseAudioContext* context, AudioBufferSourceOptions& options, ExceptionState& exceptionState) |
| +{ |
|
hongchan
2016/09/08 21:41:11
I prefer to have a DCHECK here.
Raymond Toy
2016/09/08 21:58:00
DCHECK what?
|
| + AudioBufferSourceNode* node = create(*context, exceptionState); |
| + |
| + if (!node) |
| + return node; |
|
hongchan
2016/09/08 21:41:11
nullptr?
|
| + |
| + if (options.hasBuffer()) |
| + node->setBuffer(options.buffer(), exceptionState); |
| + if (options.hasDetune()) |
| + node->detune()->setValue(options.detune()); |
| + if (options.hasLoop()) |
| + node->setLoop(options.loop()); |
| + if (options.hasLoopEnd()) |
| + node->setLoopEnd(options.loopEnd()); |
| + if (options.hasLoopStart()) |
| + node->setLoopStart(options.loopStart()); |
| + if (options.hasPlaybackRate()) |
| + node->playbackRate()->setValue(options.playbackRate()); |
| + |
| + return node; |
| +} |
| + |
| DEFINE_TRACE(AudioBufferSourceNode) |
| { |
| visitor->trace(m_playbackRate); |