| 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 Spatializer_h | 5 #ifndef Spatializer_h |
| 6 #define Spatializer_h | 6 #define Spatializer_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
| 10 #include "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
| 11 #include <memory> | 11 #include "wtf/PassOwnPtr.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class AudioBus; | 15 class AudioBus; |
| 16 | 16 |
| 17 // Abstract base class for spatializing a mono or stereo source. | 17 // Abstract base class for spatializing a mono or stereo source. |
| 18 class PLATFORM_EXPORT Spatializer { | 18 class PLATFORM_EXPORT Spatializer { |
| 19 USING_FAST_MALLOC(Spatializer); | 19 USING_FAST_MALLOC(Spatializer); |
| 20 WTF_MAKE_NONCOPYABLE(Spatializer); | 20 WTF_MAKE_NONCOPYABLE(Spatializer); |
| 21 public: | 21 public: |
| 22 enum { | 22 enum { |
| 23 PanningModelEqualPower = 0 | 23 PanningModelEqualPower = 0 |
| 24 | 24 |
| 25 // We have a plan to add more panning models other than equal-power. | 25 // We have a plan to add more panning models other than equal-power. |
| 26 // (such as binaural-HRTF or N-channel surround panning) | 26 // (such as binaural-HRTF or N-channel surround panning) |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 typedef unsigned PanningModel; | 29 typedef unsigned PanningModel; |
| 30 | 30 |
| 31 static std::unique_ptr<Spatializer> create(PanningModel, float sampleRate); | 31 static PassOwnPtr<Spatializer> create(PanningModel, float sampleRate); |
| 32 virtual ~Spatializer(); | 32 virtual ~Spatializer(); |
| 33 | 33 |
| 34 // Handle sample-accurate panning by AudioParam automation. | 34 // Handle sample-accurate panning by AudioParam automation. |
| 35 virtual void panWithSampleAccurateValues(const AudioBus* inputBus, AudioBus*
outputBuf, const float* panValues, size_t framesToProcess) = 0; | 35 virtual void panWithSampleAccurateValues(const AudioBus* inputBus, AudioBus*
outputBuf, const float* panValues, size_t framesToProcess) = 0; |
| 36 | 36 |
| 37 // Handle de-zippered panning to a target value. | 37 // Handle de-zippered panning to a target value. |
| 38 virtual void panToTargetValue(const AudioBus* inputBus, AudioBus* outputBuf,
float panValue, size_t framesToProcess) = 0; | 38 virtual void panToTargetValue(const AudioBus* inputBus, AudioBus* outputBuf,
float panValue, size_t framesToProcess) = 0; |
| 39 | 39 |
| 40 virtual void reset() = 0; | 40 virtual void reset() = 0; |
| 41 virtual double tailTime() const = 0; | 41 virtual double tailTime() const = 0; |
| 42 virtual double latencyTime() const = 0; | 42 virtual double latencyTime() const = 0; |
| 43 | 43 |
| 44 protected: | 44 protected: |
| 45 explicit Spatializer(PanningModel model) { } | 45 explicit Spatializer(PanningModel model) { } |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace blink | 48 } // namespace blink |
| 49 | 49 |
| 50 #endif // Spatializer_h | 50 #endif // Spatializer_h |
| OLD | NEW |