OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/webaudio/StereoPannerNode.h" | 5 #include "modules/webaudio/StereoPannerNode.h" |
6 #include "bindings/core/v8/ExceptionMessages.h" | 6 #include "bindings/core/v8/ExceptionMessages.h" |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
9 #include "core/dom/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
10 #include "modules/webaudio/AudioNodeInput.h" | 10 #include "modules/webaudio/AudioNodeInput.h" |
11 #include "modules/webaudio/AudioNodeOutput.h" | 11 #include "modules/webaudio/AudioNodeOutput.h" |
12 #include "modules/webaudio/BaseAudioContext.h" | 12 #include "modules/webaudio/BaseAudioContext.h" |
| 13 #include "modules/webaudio/StereoPannerOptions.h" |
13 #include "platform/audio/StereoPanner.h" | 14 #include "platform/audio/StereoPanner.h" |
14 #include "wtf/MathExtras.h" | 15 #include "wtf/MathExtras.h" |
15 | 16 |
16 namespace blink { | 17 namespace blink { |
17 | 18 |
18 StereoPannerHandler::StereoPannerHandler(AudioNode& node, float sampleRate, Audi
oParamHandler& pan) | 19 StereoPannerHandler::StereoPannerHandler(AudioNode& node, float sampleRate, Audi
oParamHandler& pan) |
19 : AudioHandler(NodeTypeStereoPanner, node, sampleRate) | 20 : AudioHandler(NodeTypeStereoPanner, node, sampleRate) |
20 , m_pan(pan) | 21 , m_pan(pan) |
21 , m_sampleAccuratePanValues(ProcessingSizeInFrames) | 22 , m_sampleAccuratePanValues(ProcessingSizeInFrames) |
22 { | 23 { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 DCHECK(isMainThread()); | 147 DCHECK(isMainThread()); |
147 | 148 |
148 if (context.isContextClosed()) { | 149 if (context.isContextClosed()) { |
149 context.throwExceptionForClosedState(exceptionState); | 150 context.throwExceptionForClosedState(exceptionState); |
150 return nullptr; | 151 return nullptr; |
151 } | 152 } |
152 | 153 |
153 return new StereoPannerNode(context); | 154 return new StereoPannerNode(context); |
154 } | 155 } |
155 | 156 |
| 157 StereoPannerNode* StereoPannerNode::create(BaseAudioContext* context, const Ster
eoPannerOptions& options, ExceptionState& exceptionState) |
| 158 { |
| 159 StereoPannerNode* node = create(*context, exceptionState); |
| 160 |
| 161 if (!node) |
| 162 return nullptr; |
| 163 |
| 164 node->handleChannelOptions(options, exceptionState); |
| 165 |
| 166 if (options.hasPan()) |
| 167 node->pan()->setValue(options.pan()); |
| 168 |
| 169 return node; |
| 170 } |
| 171 |
156 DEFINE_TRACE(StereoPannerNode) | 172 DEFINE_TRACE(StereoPannerNode) |
157 { | 173 { |
158 visitor->trace(m_pan); | 174 visitor->trace(m_pan); |
159 AudioNode::trace(visitor); | 175 AudioNode::trace(visitor); |
160 } | 176 } |
161 | 177 |
162 AudioParam* StereoPannerNode::pan() const | 178 AudioParam* StereoPannerNode::pan() const |
163 { | 179 { |
164 return m_pan; | 180 return m_pan; |
165 } | 181 } |
166 | 182 |
167 } // namespace blink | 183 } // namespace blink |
168 | 184 |
OLD | NEW |