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