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 14 matching lines...) Expand all Loading... |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
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 ReverbInputBuffer_h | 29 #ifndef ReverbInputBuffer_h |
30 #define ReverbInputBuffer_h | 30 #define ReverbInputBuffer_h |
31 | 31 |
32 #include "platform/PlatformExport.h" | 32 #include "platform/PlatformExport.h" |
33 #include "platform/audio/AudioArray.h" | 33 #include "platform/audio/AudioArray.h" |
34 | 34 |
35 namespace WebCore { | 35 namespace blink { |
36 | 36 |
37 // ReverbInputBuffer is used to buffer input samples for deferred processing by
the background threads. | 37 // ReverbInputBuffer is used to buffer input samples for deferred processing by
the background threads. |
38 class PLATFORM_EXPORT ReverbInputBuffer { | 38 class PLATFORM_EXPORT ReverbInputBuffer { |
39 public: | 39 public: |
40 ReverbInputBuffer(size_t length); | 40 ReverbInputBuffer(size_t length); |
41 | 41 |
42 // The realtime audio thread keeps writing samples here. | 42 // The realtime audio thread keeps writing samples here. |
43 // The assumption is that the buffer's length is evenly divisible by numberO
fFrames (for nearly all cases this will be fine). | 43 // The assumption is that the buffer's length is evenly divisible by numberO
fFrames (for nearly all cases this will be fine). |
44 // FIXME: remove numberOfFrames restriction... | 44 // FIXME: remove numberOfFrames restriction... |
45 void write(const float* sourceP, size_t numberOfFrames); | 45 void write(const float* sourceP, size_t numberOfFrames); |
46 | 46 |
47 // Background threads can call this to check if there's anything to read... | 47 // Background threads can call this to check if there's anything to read... |
48 size_t writeIndex() const { return m_writeIndex; } | 48 size_t writeIndex() const { return m_writeIndex; } |
49 | 49 |
50 // The individual background threads read here (and hope that they can keep
up with the buffer writing). | 50 // The individual background threads read here (and hope that they can keep
up with the buffer writing). |
51 // readIndex is updated with the next readIndex to read from... | 51 // readIndex is updated with the next readIndex to read from... |
52 // The assumption is that the buffer's length is evenly divisible by numberO
fFrames. | 52 // The assumption is that the buffer's length is evenly divisible by numberO
fFrames. |
53 // FIXME: remove numberOfFrames restriction... | 53 // FIXME: remove numberOfFrames restriction... |
54 float* directReadFrom(int* readIndex, size_t numberOfFrames); | 54 float* directReadFrom(int* readIndex, size_t numberOfFrames); |
55 | 55 |
56 void reset(); | 56 void reset(); |
57 | 57 |
58 private: | 58 private: |
59 AudioFloatArray m_buffer; | 59 AudioFloatArray m_buffer; |
60 size_t m_writeIndex; | 60 size_t m_writeIndex; |
61 }; | 61 }; |
62 | 62 |
63 } // namespace WebCore | 63 } // namespace blink |
64 | 64 |
65 #endif // ReverbInputBuffer_h | 65 #endif // ReverbInputBuffer_h |
OLD | NEW |