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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 WTF_MAKE_NONCOPYABLE(Reverb); | 47 WTF_MAKE_NONCOPYABLE(Reverb); |
48 | 48 |
49 public: | 49 public: |
50 enum { MaxFrameSize = 256 }; | 50 enum { MaxFrameSize = 256 }; |
51 | 51 |
52 // renderSliceSize is a rendering hint, so the FFTs can be optimized to not | 52 // renderSliceSize is a rendering hint, so the FFTs can be optimized to not |
53 // all occur at the same time (very bad when rendering on a real-time thread). | 53 // all occur at the same time (very bad when rendering on a real-time thread). |
54 Reverb(AudioBus* impulseResponseBuffer, | 54 Reverb(AudioBus* impulseResponseBuffer, |
55 size_t renderSliceSize, | 55 size_t renderSliceSize, |
56 size_t maxFFTSize, | 56 size_t maxFFTSize, |
57 size_t numberOfChannels, | |
58 bool useBackgroundThreads, | 57 bool useBackgroundThreads, |
59 bool normalize); | 58 bool normalize); |
60 | 59 |
61 void process(const AudioBus* sourceBus, | 60 void process(const AudioBus* sourceBus, |
62 AudioBus* destinationBus, | 61 AudioBus* destinationBus, |
63 size_t framesToProcess); | 62 size_t framesToProcess); |
64 void reset(); | 63 void reset(); |
65 | 64 |
66 size_t impulseResponseLength() const { return m_impulseResponseLength; } | 65 size_t impulseResponseLength() const { return m_impulseResponseLength; } |
67 size_t latencyFrames() const; | 66 size_t latencyFrames() const; |
68 | 67 |
69 private: | 68 private: |
70 void initialize(AudioBus* impulseResponseBuffer, | 69 void initialize(AudioBus* impulseResponseBuffer, |
71 size_t renderSliceSize, | 70 size_t renderSliceSize, |
72 size_t maxFFTSize, | 71 size_t maxFFTSize, |
73 size_t numberOfChannels, | |
74 bool useBackgroundThreads); | 72 bool useBackgroundThreads); |
75 | 73 |
76 size_t m_impulseResponseLength; | 74 size_t m_impulseResponseLength; |
| 75 // The actual number of channels in the response. This can be less |
| 76 // than the number of ReverbConvolver's in |m_convolvers|. |
| 77 unsigned m_numberOfResponseChannels; |
77 | 78 |
78 Vector<std::unique_ptr<ReverbConvolver>> m_convolvers; | 79 Vector<std::unique_ptr<ReverbConvolver>> m_convolvers; |
79 | 80 |
80 // For "True" stereo processing | 81 // For "True" stereo processing |
81 RefPtr<AudioBus> m_tempBuffer; | 82 RefPtr<AudioBus> m_tempBuffer; |
82 }; | 83 }; |
83 | 84 |
84 } // namespace blink | 85 } // namespace blink |
85 | 86 |
86 #endif // Reverb_h | 87 #endif // Reverb_h |
OLD | NEW |