OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ConstantSourceNode_h |
| 6 #define ConstantSourceNode_h |
| 7 |
| 8 #include "modules/webaudio/AudioParam.h" |
| 9 #include "modules/webaudio/AudioScheduledSourceNode.h" |
| 10 #include "platform/audio/AudioBus.h" |
| 11 #include "wtf/PassRefPtr.h" |
| 12 #include "wtf/RefPtr.h" |
| 13 #include "wtf/Threading.h" |
| 14 |
| 15 namespace blink { |
| 16 |
| 17 class BaseAudioContext; |
| 18 class ConstantSourceOptions; |
| 19 class ExceptionState; |
| 20 |
| 21 // ConstantSourceNode is an audio generator for a constant source |
| 22 |
| 23 class ConstantSourceHandler final : public AudioScheduledSourceHandler { |
| 24 public: |
| 25 static PassRefPtr<ConstantSourceHandler> create( |
| 26 AudioNode&, float sampleRate, AudioParamHandler& offset); |
| 27 ~ConstantSourceHandler() override; |
| 28 |
| 29 // AudioHandler |
| 30 void process(size_t framesToProcess) override; |
| 31 private: |
| 32 ConstantSourceHandler(AudioNode&, float sampleRate, AudioParamHandler& offse
t); |
| 33 |
| 34 // If we are no longer playing, propogate silence ahead to downstream nodes. |
| 35 bool propagatesSilence() const override; |
| 36 |
| 37 RefPtr<AudioParamHandler> m_offset; |
| 38 AudioFloatArray m_sampleAccurateValues; |
| 39 }; |
| 40 |
| 41 class ConstantSourceNode final : public AudioScheduledSourceNode { |
| 42 DEFINE_WRAPPERTYPEINFO(); |
| 43 public: |
| 44 static ConstantSourceNode* create(BaseAudioContext&, ExceptionState&); |
| 45 static ConstantSourceNode* create(BaseAudioContext*, const ConstantSourceOpt
ions&, ExceptionState&); |
| 46 DECLARE_VIRTUAL_TRACE(); |
| 47 |
| 48 AudioParam* offset(); |
| 49 |
| 50 private: |
| 51 ConstantSourceNode(BaseAudioContext&); |
| 52 ConstantSourceHandler& constantSourceHandler() const; |
| 53 |
| 54 Member<AudioParam> m_offset; |
| 55 }; |
| 56 |
| 57 } // namespace blink |
| 58 |
| 59 #endif // ConstantSourceNode_h |
OLD | NEW |