| 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 18 matching lines...) Expand all Loading... |
| 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 #include "wtf/Allocator.h" | 34 #include "wtf/Allocator.h" |
| 35 #include "wtf/Noncopyable.h" | 35 #include "wtf/Noncopyable.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 // ReverbInputBuffer is used to buffer input samples for deferred processing by
the background threads. | 39 // ReverbInputBuffer is used to buffer input samples for deferred processing by |
| 40 // the background threads. |
| 40 class PLATFORM_EXPORT ReverbInputBuffer { | 41 class PLATFORM_EXPORT ReverbInputBuffer { |
| 41 DISALLOW_NEW(); | 42 DISALLOW_NEW(); |
| 42 WTF_MAKE_NONCOPYABLE(ReverbInputBuffer); | 43 WTF_MAKE_NONCOPYABLE(ReverbInputBuffer); |
| 43 | 44 |
| 44 public: | 45 public: |
| 45 ReverbInputBuffer(size_t length); | 46 ReverbInputBuffer(size_t length); |
| 46 | 47 |
| 47 // The realtime audio thread keeps writing samples here. | 48 // The realtime audio thread keeps writing samples here. |
| 48 // The assumption is that the buffer's length is evenly divisible by numberOfF
rames (for nearly all cases this will be fine). | 49 // The assumption is that the buffer's length is evenly divisible by |
| 50 // numberOfFrames (for nearly all cases this will be fine). |
| 49 // FIXME: remove numberOfFrames restriction... | 51 // FIXME: remove numberOfFrames restriction... |
| 50 void write(const float* sourceP, size_t numberOfFrames); | 52 void write(const float* sourceP, size_t numberOfFrames); |
| 51 | 53 |
| 52 // Background threads can call this to check if there's anything to read... | 54 // Background threads can call this to check if there's anything to read... |
| 53 size_t writeIndex() const { return m_writeIndex; } | 55 size_t writeIndex() const { return m_writeIndex; } |
| 54 | 56 |
| 55 // The individual background threads read here (and hope that they can keep up
with the buffer writing). | 57 // The individual background threads read here (and hope that they can keep up |
| 58 // with the buffer writing). |
| 56 // readIndex is updated with the next readIndex to read from... | 59 // readIndex is updated with the next readIndex to read from... |
| 57 // The assumption is that the buffer's length is evenly divisible by numberOfF
rames. | 60 // The assumption is that the buffer's length is evenly divisible by |
| 61 // numberOfFrames. |
| 58 // FIXME: remove numberOfFrames restriction... | 62 // FIXME: remove numberOfFrames restriction... |
| 59 float* directReadFrom(int* readIndex, size_t numberOfFrames); | 63 float* directReadFrom(int* readIndex, size_t numberOfFrames); |
| 60 | 64 |
| 61 void reset(); | 65 void reset(); |
| 62 | 66 |
| 63 private: | 67 private: |
| 64 AudioFloatArray m_buffer; | 68 AudioFloatArray m_buffer; |
| 65 size_t m_writeIndex; | 69 size_t m_writeIndex; |
| 66 }; | 70 }; |
| 67 | 71 |
| 68 } // namespace blink | 72 } // namespace blink |
| 69 | 73 |
| 70 #endif // ReverbInputBuffer_h | 74 #endif // ReverbInputBuffer_h |
| OLD | NEW |