Chromium Code Reviews| 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 StereoPanner_h | 5 #ifndef StereoPanner_h |
| 6 #define StereoPanner_h | 6 #define StereoPanner_h |
| 7 | 7 |
| 8 #include "platform/audio/Spatializer.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "wtf/Allocator.h" | |
| 10 #include "wtf/Noncopyable.h" | |
| 11 #include <memory> | |
|
Raymond Toy
2016/08/24 18:30:29
Is including memory needed here? Is it for USING_
hongchan
2016/08/24 21:52:33
Done.
| |
| 9 | 12 |
| 10 namespace blink { | 13 namespace blink { |
| 11 | 14 |
| 12 // Common type of stereo panner as found in normal audio mixing equipment. | 15 class AudioBus; |
| 13 // See: http://webaudio.github.io/web-audio-api/#the-stereopannernode-interface | |
| 14 | 16 |
| 15 class PLATFORM_EXPORT StereoPanner final : public Spatializer { | 17 // Implement the equal-power panning algorithm for mono or stereo input. See: |
| 18 // http://webaudio.github.io/web-audio-api/#panning-algorithm | |
| 19 | |
| 20 class PLATFORM_EXPORT StereoPanner { | |
| 21 USING_FAST_MALLOC(StereoPanner); | |
| 22 WTF_MAKE_NONCOPYABLE(StereoPanner); | |
| 23 | |
| 16 public: | 24 public: |
| 25 static std::unique_ptr<StereoPanner> create(float sampleRate); | |
| 26 ~StereoPanner() { }; | |
| 27 | |
| 28 void panWithSampleAccurateValues(const AudioBus* inputBus, AudioBus* outputB us, const float* panValues, size_t framesToProcess); | |
| 29 void panToTargetValue(const AudioBus* inputBus, AudioBus* outputBus, float p anValue, size_t framesToProcess); | |
| 30 | |
| 31 private: | |
| 17 explicit StereoPanner(float sampleRate); | 32 explicit StereoPanner(float sampleRate); |
| 18 | 33 |
| 19 void panWithSampleAccurateValues(const AudioBus* inputBus, AudioBus* outputB uf, const float* panValues, size_t framesToProcess) override; | |
| 20 void panToTargetValue(const AudioBus* inputBus, AudioBus* outputBuf, float p anValue, size_t framesToProcess) override; | |
| 21 | |
| 22 void reset() override { } | |
| 23 | |
| 24 double tailTime() const override { return 0; } | |
| 25 double latencyTime() const override { return 0; } | |
| 26 | |
| 27 private: | |
| 28 bool m_isFirstRender; | 34 bool m_isFirstRender; |
| 29 double m_smoothingConstant; | 35 double m_smoothingConstant; |
| 30 | 36 |
| 31 double m_pan; | 37 double m_pan; |
| 32 }; | 38 }; |
| 33 | 39 |
| 34 } // namespace blink | 40 } // namespace blink |
| 35 | 41 |
| 36 #endif // StereoPanner_h | 42 #endif // StereoPanner_h |
| OLD | NEW |