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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/ChannelSplitterNode.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 11 matching lines...) Expand all
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24 24
25 #include "modules/webaudio/ChannelSplitterNode.h" 25 #include "modules/webaudio/ChannelSplitterNode.h"
26 #include "bindings/core/v8/ExceptionMessages.h" 26 #include "bindings/core/v8/ExceptionMessages.h"
27 #include "bindings/core/v8/ExceptionState.h" 27 #include "bindings/core/v8/ExceptionState.h"
28 #include "core/dom/ExceptionCode.h" 28 #include "core/dom/ExceptionCode.h"
29 #include "modules/webaudio/AudioNodeInput.h" 29 #include "modules/webaudio/AudioNodeInput.h"
30 #include "modules/webaudio/AudioNodeOutput.h" 30 #include "modules/webaudio/AudioNodeOutput.h"
31 #include "modules/webaudio/BaseAudioContext.h" 31 #include "modules/webaudio/BaseAudioContext.h"
32 #include "modules/webaudio/ChannelSplitterOptions.h"
32 33
33 namespace blink { 34 namespace blink {
34 35
35 ChannelSplitterHandler::ChannelSplitterHandler(AudioNode& node, float sampleRate , unsigned numberOfOutputs) 36 ChannelSplitterHandler::ChannelSplitterHandler(AudioNode& node, float sampleRate , unsigned numberOfOutputs)
36 : AudioHandler(NodeTypeChannelSplitter, node, sampleRate) 37 : AudioHandler(NodeTypeChannelSplitter, node, sampleRate)
37 { 38 {
38 addInput(); 39 addInput();
39 40
40 // Create a fixed number of outputs (able to handle the maximum number of ch annels fed to an input). 41 // Create a fixed number of outputs (able to handle the maximum number of ch annels fed to an input).
41 for (unsigned i = 0; i < numberOfOutputs; ++i) 42 for (unsigned i = 0; i < numberOfOutputs; ++i)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 1, 107 1,
107 ExceptionMessages::InclusiveBound, 108 ExceptionMessages::InclusiveBound,
108 BaseAudioContext::maxNumberOfChannels(), 109 BaseAudioContext::maxNumberOfChannels(),
109 ExceptionMessages::InclusiveBound)); 110 ExceptionMessages::InclusiveBound));
110 return nullptr; 111 return nullptr;
111 } 112 }
112 113
113 return new ChannelSplitterNode(context, numberOfOutputs); 114 return new ChannelSplitterNode(context, numberOfOutputs);
114 } 115 }
115 116
117 ChannelSplitterNode* ChannelSplitterNode::create(BaseAudioContext* context, cons t ChannelSplitterOptions& options, ExceptionState& exceptionState)
118 {
119 ChannelSplitterNode* node = create(*context, options.numberOfOutputs(), exce ptionState);
120
121 if (!node)
122 return nullptr;
123
124 node->handleChannelOptions(options, exceptionState);
125
126 return node;
127 }
128
116 } // namespace blink 129 } // namespace blink
117 130
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698