OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 15 matching lines...) Expand all Loading... |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #ifndef Reverb_h | 29 #ifndef Reverb_h |
30 #define Reverb_h | 30 #define Reverb_h |
31 | 31 |
32 #include "platform/audio/ReverbConvolver.h" | 32 #include "platform/audio/ReverbConvolver.h" |
33 #include "wtf/Allocator.h" | 33 #include "wtf/Allocator.h" |
34 #include "wtf/Noncopyable.h" | 34 #include "wtf/Noncopyable.h" |
35 #include "wtf/Vector.h" | 35 #include "wtf/Vector.h" |
| 36 #include <memory> |
36 | 37 |
37 namespace blink { | 38 namespace blink { |
38 | 39 |
39 class AudioBus; | 40 class AudioBus; |
40 | 41 |
41 // Multi-channel convolution reverb with channel matrixing - one or more ReverbC
onvolver objects are used internally. | 42 // Multi-channel convolution reverb with channel matrixing - one or more ReverbC
onvolver objects are used internally. |
42 | 43 |
43 class PLATFORM_EXPORT Reverb { | 44 class PLATFORM_EXPORT Reverb { |
44 USING_FAST_MALLOC(Reverb); | 45 USING_FAST_MALLOC(Reverb); |
45 WTF_MAKE_NONCOPYABLE(Reverb); | 46 WTF_MAKE_NONCOPYABLE(Reverb); |
46 public: | 47 public: |
47 enum { MaxFrameSize = 256 }; | 48 enum { MaxFrameSize = 256 }; |
48 | 49 |
49 // renderSliceSize is a rendering hint, so the FFTs can be optimized to not
all occur at the same time (very bad when rendering on a real-time thread). | 50 // renderSliceSize is a rendering hint, so the FFTs can be optimized to not
all occur at the same time (very bad when rendering on a real-time thread). |
50 Reverb(AudioBus* impulseResponseBuffer, size_t renderSliceSize, size_t maxFF
TSize, size_t numberOfChannels, bool useBackgroundThreads, bool normalize); | 51 Reverb(AudioBus* impulseResponseBuffer, size_t renderSliceSize, size_t maxFF
TSize, size_t numberOfChannels, bool useBackgroundThreads, bool normalize); |
51 | 52 |
52 void process(const AudioBus* sourceBus, AudioBus* destinationBus, size_t fra
mesToProcess); | 53 void process(const AudioBus* sourceBus, AudioBus* destinationBus, size_t fra
mesToProcess); |
53 void reset(); | 54 void reset(); |
54 | 55 |
55 size_t impulseResponseLength() const { return m_impulseResponseLength; } | 56 size_t impulseResponseLength() const { return m_impulseResponseLength; } |
56 size_t latencyFrames() const; | 57 size_t latencyFrames() const; |
57 | 58 |
58 private: | 59 private: |
59 void initialize(AudioBus* impulseResponseBuffer, size_t renderSliceSize, siz
e_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads); | 60 void initialize(AudioBus* impulseResponseBuffer, size_t renderSliceSize, siz
e_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads); |
60 | 61 |
61 size_t m_impulseResponseLength; | 62 size_t m_impulseResponseLength; |
62 | 63 |
63 Vector<OwnPtr<ReverbConvolver>> m_convolvers; | 64 Vector<std::unique_ptr<ReverbConvolver>> m_convolvers; |
64 | 65 |
65 // For "True" stereo processing | 66 // For "True" stereo processing |
66 RefPtr<AudioBus> m_tempBuffer; | 67 RefPtr<AudioBus> m_tempBuffer; |
67 }; | 68 }; |
68 | 69 |
69 } // namespace blink | 70 } // namespace blink |
70 | 71 |
71 #endif // Reverb_h | 72 #endif // Reverb_h |
OLD | NEW |