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