| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ConstantSourceNode.h" | 5 #include "modules/webaudio/ConstantSourceNode.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionMessages.h" | 7 #include "bindings/core/v8/ExceptionMessages.h" |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
| 10 #include "modules/webaudio/AudioNodeOutput.h" | 10 #include "modules/webaudio/AudioNodeOutput.h" |
| 11 #include "modules/webaudio/ConstantSourceOptions.h" | 11 #include "modules/webaudio/ConstantSourceOptions.h" |
| 12 #include "platform/audio/AudioUtilities.h" | 12 #include "platform/audio/AudioUtilities.h" |
| 13 #include "wtf/MathExtras.h" | 13 #include "wtf/MathExtras.h" |
| 14 #include "wtf/StdLibExtras.h" | 14 #include "wtf/StdLibExtras.h" |
| 15 #include <algorithm> | 15 #include <algorithm> |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 ConstantSourceHandler::ConstantSourceHandler(AudioNode& node, | 19 ConstantSourceHandler::ConstantSourceHandler(AudioNode& node, |
| 20 float sampleRate, | 20 float sampleRate, |
| 21 AudioParamHandler& offset) | 21 AudioParamHandler& offset) |
| 22 : AudioScheduledSourceHandler(NodeTypeConstantSource, node, sampleRate), | 22 : AudioScheduledSourceHandler(NodeTypeConstantSource, node, sampleRate), |
| 23 m_offset(offset), | 23 m_offset(offset), |
| 24 m_sampleAccurateValues(ProcessingSizeInFrames) { | 24 m_sampleAccurateValues(AudioUtilities::kRenderQuantumFrames) { |
| 25 // A ConstantSource is always mono. | 25 // A ConstantSource is always mono. |
| 26 addOutput(1); | 26 addOutput(1); |
| 27 | 27 |
| 28 initialize(); | 28 initialize(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 PassRefPtr<ConstantSourceHandler> ConstantSourceHandler::create( | 31 PassRefPtr<ConstantSourceHandler> ConstantSourceHandler::create( |
| 32 AudioNode& node, | 32 AudioNode& node, |
| 33 float sampleRate, | 33 float sampleRate, |
| 34 AudioParamHandler& offset) { | 34 AudioParamHandler& offset) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 ConstantSourceHandler& ConstantSourceNode::constantSourceHandler() const { | 147 ConstantSourceHandler& ConstantSourceNode::constantSourceHandler() const { |
| 148 return static_cast<ConstantSourceHandler&>(handler()); | 148 return static_cast<ConstantSourceHandler&>(handler()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 AudioParam* ConstantSourceNode::offset() { | 151 AudioParam* ConstantSourceNode::offset() { |
| 152 return m_offset; | 152 return m_offset; |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace blink | 155 } // namespace blink |
| OLD | NEW |