| 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 #ifndef StereoPannerNode_h | 5 #ifndef StereoPannerNode_h |
| 6 #define StereoPannerNode_h | 6 #define StereoPannerNode_h |
| 7 | 7 |
| 8 #include "modules/webaudio/AudioNode.h" | 8 #include "modules/webaudio/AudioNode.h" |
| 9 #include "modules/webaudio/AudioParam.h" | 9 #include "modules/webaudio/AudioParam.h" |
| 10 #include "platform/audio/AudioBus.h" | 10 #include "platform/audio/AudioBus.h" |
| 11 #include "platform/audio/Spatializer.h" | 11 #include "platform/audio/Spatializer.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class AbstractAudioContext; |
| 16 |
| 15 // StereoPannerNode is an AudioNode with one input and one output. It is | 17 // StereoPannerNode is an AudioNode with one input and one output. It is |
| 16 // specifically designed for equal-power stereo panning. | 18 // specifically designed for equal-power stereo panning. |
| 17 class StereoPannerHandler final : public AudioHandler { | 19 class StereoPannerHandler final : public AudioHandler { |
| 18 public: | 20 public: |
| 19 static PassRefPtr<StereoPannerHandler> create(AudioNode&, float sampleRate,
AudioParamHandler& pan); | 21 static PassRefPtr<StereoPannerHandler> create(AudioNode&, float sampleRate,
AudioParamHandler& pan); |
| 20 ~StereoPannerHandler() override; | 22 ~StereoPannerHandler() override; |
| 21 | 23 |
| 22 void process(size_t framesToProcess) override; | 24 void process(size_t framesToProcess) override; |
| 23 void initialize() override; | 25 void initialize() override; |
| 24 | 26 |
| 25 void setChannelCount(unsigned long, ExceptionState&) final; | 27 void setChannelCount(unsigned long, ExceptionState&) final; |
| 26 void setChannelCountMode(const String&, ExceptionState&) final; | 28 void setChannelCountMode(const String&, ExceptionState&) final; |
| 27 | 29 |
| 28 private: | 30 private: |
| 29 StereoPannerHandler(AudioNode&, float sampleRate, AudioParamHandler& pan); | 31 StereoPannerHandler(AudioNode&, float sampleRate, AudioParamHandler& pan); |
| 30 | 32 |
| 31 OwnPtr<Spatializer> m_stereoPanner; | 33 OwnPtr<Spatializer> m_stereoPanner; |
| 32 RefPtr<AudioParamHandler> m_pan; | 34 RefPtr<AudioParamHandler> m_pan; |
| 33 | 35 |
| 34 AudioFloatArray m_sampleAccuratePanValues; | 36 AudioFloatArray m_sampleAccuratePanValues; |
| 35 | 37 |
| 36 // TODO(tkent): Use FRIEND_TEST macro provided by gtest_prod.h | 38 // TODO(tkent): Use FRIEND_TEST macro provided by gtest_prod.h |
| 37 friend class StereoPannerNodeTest_StereoPannerLifetime_Test; | 39 friend class StereoPannerNodeTest_StereoPannerLifetime_Test; |
| 38 }; | 40 }; |
| 39 | 41 |
| 40 class StereoPannerNode final : public AudioNode { | 42 class StereoPannerNode final : public AudioNode { |
| 41 DEFINE_WRAPPERTYPEINFO(); | 43 DEFINE_WRAPPERTYPEINFO(); |
| 42 public: | 44 public: |
| 43 static StereoPannerNode* create(AudioContext&, float sampleRate); | 45 static StereoPannerNode* create(AbstractAudioContext&, float sampleRate); |
| 44 DECLARE_VIRTUAL_TRACE(); | 46 DECLARE_VIRTUAL_TRACE(); |
| 45 | 47 |
| 46 AudioParam* pan() const; | 48 AudioParam* pan() const; |
| 47 | 49 |
| 48 private: | 50 private: |
| 49 StereoPannerNode(AudioContext&, float sampleRate); | 51 StereoPannerNode(AbstractAudioContext&, float sampleRate); |
| 50 | 52 |
| 51 Member<AudioParam> m_pan; | 53 Member<AudioParam> m_pan; |
| 52 }; | 54 }; |
| 53 | 55 |
| 54 } // namespace blink | 56 } // namespace blink |
| 55 | 57 |
| 56 #endif // StereoPannerNode_h | 58 #endif // StereoPannerNode_h |
| OLD | NEW |