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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/ChannelMergerNode.cpp

Issue 2102133002: Add constructors for WebAudio nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 16 matching lines...) Expand all
27 */ 27 */
28 28
29 #include "modules/webaudio/ChannelMergerNode.h" 29 #include "modules/webaudio/ChannelMergerNode.h"
30 #include "bindings/core/v8/ExceptionMessages.h" 30 #include "bindings/core/v8/ExceptionMessages.h"
31 #include "bindings/core/v8/ExceptionState.h" 31 #include "bindings/core/v8/ExceptionState.h"
32 #include "core/dom/ExceptionCode.h" 32 #include "core/dom/ExceptionCode.h"
33 #include "core/dom/ExecutionContext.h" 33 #include "core/dom/ExecutionContext.h"
34 #include "modules/webaudio/AudioNodeInput.h" 34 #include "modules/webaudio/AudioNodeInput.h"
35 #include "modules/webaudio/AudioNodeOutput.h" 35 #include "modules/webaudio/AudioNodeOutput.h"
36 #include "modules/webaudio/BaseAudioContext.h" 36 #include "modules/webaudio/BaseAudioContext.h"
37 #include "modules/webaudio/ChannelMergerOptions.h"
37 38
38 39
39 namespace blink { 40 namespace blink {
40 41
41 ChannelMergerHandler::ChannelMergerHandler(AudioNode& node, float sampleRate, un signed numberOfInputs) 42 ChannelMergerHandler::ChannelMergerHandler(AudioNode& node, float sampleRate, un signed numberOfInputs)
42 : AudioHandler(NodeTypeChannelMerger, node, sampleRate) 43 : AudioHandler(NodeTypeChannelMerger, node, sampleRate)
43 { 44 {
44 // These properties are fixed for the node and cannot be changed by user. 45 // These properties are fixed for the node and cannot be changed by user.
45 m_channelCount = 1; 46 m_channelCount = 1;
46 setInternalChannelCountMode(Explicit); 47 setInternalChannelCountMode(Explicit);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 1, 152 1,
152 ExceptionMessages::InclusiveBound, 153 ExceptionMessages::InclusiveBound,
153 BaseAudioContext::maxNumberOfChannels(), 154 BaseAudioContext::maxNumberOfChannels(),
154 ExceptionMessages::InclusiveBound)); 155 ExceptionMessages::InclusiveBound));
155 return nullptr; 156 return nullptr;
156 } 157 }
157 158
158 return new ChannelMergerNode(context, numberOfInputs); 159 return new ChannelMergerNode(context, numberOfInputs);
159 } 160 }
160 161
162 ChannelMergerNode* ChannelMergerNode::create(BaseAudioContext* context, const Ch annelMergerOptions& options, ExceptionState& exceptionState)
163 {
164 ChannelMergerNode* node;
165
166 node = create(*context, options.numberOfInputs(), exceptionState);
167
168 if (!node)
169 return node;
hongchan 2016/09/12 18:56:32 return nullptr;
170
171 node->handleChannelOptions(options, exceptionState);
172
173 return node;
174 }
175
161 } // namespace blink 176 } // namespace blink
162 177
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698