| 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> | |
| 37 | 36 |
| 38 namespace blink { | 37 namespace blink { |
| 39 | 38 |
| 40 class AudioBus; | 39 class AudioBus; |
| 41 | 40 |
| 42 // Multi-channel convolution reverb with channel matrixing - one or more ReverbC
onvolver objects are used internally. | 41 // Multi-channel convolution reverb with channel matrixing - one or more ReverbC
onvolver objects are used internally. |
| 43 | 42 |
| 44 class PLATFORM_EXPORT Reverb { | 43 class PLATFORM_EXPORT Reverb { |
| 45 USING_FAST_MALLOC(Reverb); | 44 USING_FAST_MALLOC(Reverb); |
| 46 WTF_MAKE_NONCOPYABLE(Reverb); | 45 WTF_MAKE_NONCOPYABLE(Reverb); |
| 47 public: | 46 public: |
| 48 enum { MaxFrameSize = 256 }; | 47 enum { MaxFrameSize = 256 }; |
| 49 | 48 |
| 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). | 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). |
| 51 Reverb(AudioBus* impulseResponseBuffer, size_t renderSliceSize, size_t maxFF
TSize, size_t numberOfChannels, bool useBackgroundThreads, bool normalize); | 50 Reverb(AudioBus* impulseResponseBuffer, size_t renderSliceSize, size_t maxFF
TSize, size_t numberOfChannels, bool useBackgroundThreads, bool normalize); |
| 52 | 51 |
| 53 void process(const AudioBus* sourceBus, AudioBus* destinationBus, size_t fra
mesToProcess); | 52 void process(const AudioBus* sourceBus, AudioBus* destinationBus, size_t fra
mesToProcess); |
| 54 void reset(); | 53 void reset(); |
| 55 | 54 |
| 56 size_t impulseResponseLength() const { return m_impulseResponseLength; } | 55 size_t impulseResponseLength() const { return m_impulseResponseLength; } |
| 57 size_t latencyFrames() const; | 56 size_t latencyFrames() const; |
| 58 | 57 |
| 59 private: | 58 private: |
| 60 void initialize(AudioBus* impulseResponseBuffer, size_t renderSliceSize, siz
e_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads); | 59 void initialize(AudioBus* impulseResponseBuffer, size_t renderSliceSize, siz
e_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads); |
| 61 | 60 |
| 62 size_t m_impulseResponseLength; | 61 size_t m_impulseResponseLength; |
| 63 | 62 |
| 64 Vector<std::unique_ptr<ReverbConvolver>> m_convolvers; | 63 Vector<OwnPtr<ReverbConvolver>> m_convolvers; |
| 65 | 64 |
| 66 // For "True" stereo processing | 65 // For "True" stereo processing |
| 67 RefPtr<AudioBus> m_tempBuffer; | 66 RefPtr<AudioBus> m_tempBuffer; |
| 68 }; | 67 }; |
| 69 | 68 |
| 70 } // namespace blink | 69 } // namespace blink |
| 71 | 70 |
| 72 #endif // Reverb_h | 71 #endif // Reverb_h |
| OLD | NEW |