|
arduino-audio-tools
|
A N buffer. If count=2 we create a DoubleBuffer, if count=3 a TripleBuffer etc. More...
#include <CodecOpusOgg.h>
Public Member Functions | |
| NBuffer (int size, int count) | |
| NBuffer (int size, int count) | |
| virtual | ~NBuffer () |
| virtual | ~NBuffer () |
| T * | address () |
| returns the address of the start of the actual physical read buffer | |
| T * | address () |
| returns the address of the start of the actual physical read buffer | |
| int | available () |
| determines the available entries for the current read buffer | |
| int | available () |
| determines the available entries for the current read buffer | |
| int | availableForWrite () |
| determines the available entries for the write buffer | |
| int | availableForWrite () |
| determines the available entries for the write buffer | |
| virtual int | bufferCountEmpty () |
| Provides the number of entries that are available to write. | |
| virtual int | bufferCountEmpty () |
| Provides the number of entries that are available to write. | |
| virtual int | bufferCountFilled () |
| Provides the number of entries that are available to read. | |
| virtual int | bufferCountFilled () |
| Provides the number of entries that are available to read. | |
| void | clear () |
| same as reset | |
| virtual int | clearArray (int len) |
| Removes the next len entries. | |
| void | flush () |
| void | flush () |
| virtual float | freePercent () |
| Returns the free space of the buffer in %. | |
| bool | isEmpty () |
| bool | isFull () |
| checks if the buffer is full | |
| bool | isFull () |
| checks if the buffer is full | |
| virtual float | levelPercent () |
| Returns the level of the buffer in %. | |
| virtual bool | peek (uint8_t &result)=0 |
| peeks the actual entry from the buffer | |
| bool | peek (T &result) override |
| peeks the actual entry from the buffer | |
| bool | peek (T &result) override |
| peeks the actual entry from the buffer | |
| virtual bool | read (uint8_t &result)=0 |
| reads a single value | |
| bool | read (T &result) override |
| reads an entry from the buffer | |
| bool | read (T &result) override |
| reads an entry from the buffer | |
| virtual int | readArray (uint8_t data[], int len) |
| reads multiple values | |
| int | readArray (T data[], int len) override |
| int | readArray (T data[], int len) override |
| void | reset () |
| resets all buffers | |
| void | reset () |
| resets all buffers | |
| virtual bool | resize (size_t bytes) |
| Resize the buffer to the next multiple of buffer size. | |
| virtual bool | resize (size_t bytes) |
| Resize the buffer to the next multiple of buffer size. | |
| virtual bool | resize (size_t size, int count) |
| virtual bool | resize (size_t size, int count) |
| unsigned long | sampleRate () |
| provides the actual sample rate | |
| unsigned long | sampleRate () |
| provides the actual sample rate | |
| size_t | size () |
| Provides the total capacity (=buffer size * buffer count). | |
| size_t | size () |
| Provides the total capacity (=buffer size * buffer count). | |
| virtual bool | write (uint8_t data)=0 |
| write add an entry to the buffer | |
| bool | write (T data) |
| write add an entry to the buffer | |
| bool | write (T data) |
| write add an entry to the buffer | |
| virtual int | writeArray (const uint8_t data[], int len) |
| Fills the buffer data. | |
| virtual int | writeArrayOverwrite (const uint8_t data[], int len) |
| Fills the buffer data and overwrites the oldest data if the buffer is full. | |
Protected Member Functions | |
| NBuffer ()=default | |
| empty constructor only allowed by subclass | |
| NBuffer ()=default | |
| empty constructor only allowed by subclass | |
| virtual bool | addAvailableBuffer (BaseBuffer< T > *buffer) |
| virtual bool | addAvailableBuffer (BaseBuffer< T > *buffer) |
| virtual bool | addFilledBuffer (BaseBuffer< T > *buffer) |
| virtual bool | addFilledBuffer (BaseBuffer< T > *buffer) |
| void | freeMemory () |
| void | freeMemory () |
| virtual BaseBuffer< T > * | getNextAvailableBuffer () |
| virtual BaseBuffer< T > * | getNextAvailableBuffer () |
| virtual BaseBuffer< T > * | getNextFilledBuffer () |
| virtual BaseBuffer< T > * | getNextFilledBuffer () |
| void | resetCurrent () |
| void | resetCurrent () |
Protected Attributes | |
| BaseBuffer< T > * | actual_read_buffer = nullptr |
| BaseBuffer< T > * | actual_write_buffer = nullptr |
| QueueFromVector< BaseBuffer< T > * > | available_buffers {0, nullptr} |
| size_t | buffer_count = 0 |
| int | buffer_size = 1024 |
| QueueFromVector< BaseBuffer< T > * > | filled_buffers {0, nullptr} |
| unsigned long | sample_count = 0 |
| unsigned long | start_time = 0 |
A N buffer. If count=2 we create a DoubleBuffer, if count=3 a TripleBuffer etc.
|
inline |
|
inlinevirtual |
|
protecteddefault |
empty constructor only allowed by subclass
|
inline |
|
inlinevirtual |
|
protecteddefault |
empty constructor only allowed by subclass
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlinevirtual |
returns the address of the start of the actual physical read buffer
Implements BaseBuffer< uint8_t >.
|
inlinevirtual |
returns the address of the start of the actual physical read buffer
Implements BaseBuffer< uint8_t >.
|
inlinevirtual |
determines the available entries for the current read buffer
Implements BaseBuffer< uint8_t >.
|
inlinevirtual |
determines the available entries for the current read buffer
Implements BaseBuffer< uint8_t >.
|
inlinevirtual |
determines the available entries for the write buffer
Implements BaseBuffer< uint8_t >.
|
inlinevirtual |
determines the available entries for the write buffer
Implements BaseBuffer< uint8_t >.
|
inlinevirtual |
Provides the number of entries that are available to write.
Reimplemented from BaseBuffer< uint8_t >.
Reimplemented in SynchronizedNBufferRTOST< T >, SynchronizedNBufferRTOST< uint8_t >, SynchronizedNBufferZephyrT< T >, and SynchronizedNBufferZephyrT< uint8_t >.
|
inlinevirtual |
Provides the number of entries that are available to write.
Reimplemented from BaseBuffer< uint8_t >.
|
inlinevirtual |
Provides the number of entries that are available to read.
Reimplemented from BaseBuffer< uint8_t >.
Reimplemented in SynchronizedNBufferRTOST< T >, SynchronizedNBufferRTOST< uint8_t >, SynchronizedNBufferZephyrT< T >, and SynchronizedNBufferZephyrT< uint8_t >.
|
inlinevirtual |
Provides the number of entries that are available to read.
Reimplemented from BaseBuffer< uint8_t >.
|
inlineinherited |
same as reset
|
inlinevirtualinherited |
Removes the next len entries.
Reimplemented in SingleBuffer< T >, SingleBuffer< T >, SingleBuffer< uint8_t >, and SingleBuffer< T >.
|
inlinevirtual |
Submit the partially-filled write buffer to the filled queue so the reader can access it immediately. Call after writeArray() when the writer won't add more data to the current block for a while.
Reimplemented from BaseBuffer< uint8_t >.
|
inlinevirtual |
Submit the partially-filled write buffer to the filled queue so the reader can access it immediately. Call after writeArray() when the writer won't add more data to the current block for a while.
Reimplemented from BaseBuffer< uint8_t >.
|
inlineprotected |
|
inlineprotected |
|
inlinevirtualinherited |
Returns the free space of the buffer in %.
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inlineinherited |
|
inlinevirtual |
checks if the buffer is full
Reimplemented from BaseBuffer< uint8_t >.
|
inlinevirtual |
checks if the buffer is full
Reimplemented from BaseBuffer< uint8_t >.
|
inlinevirtualinherited |
Returns the level of the buffer in %.
Reimplemented in AdaptiveResamplingBuffer.
|
pure virtualinherited |
peeks the actual entry from the buffer
Implemented in AdaptiveResamplingBuffer, NBuffer< uint8_t >, RingBuffer< uint8_t >, RingBufferSPSC< uint8_t >, SingleBuffer< uint8_t >, BufferRP2040T< uint8_t >, and BufferRTOS< uint8_t >.
|
inlineoverride |
peeks the actual entry from the buffer
|
inlineoverride |
peeks the actual entry from the buffer
|
pure virtualinherited |
reads a single value
Implemented in AdaptiveResamplingBuffer, NBuffer< uint8_t >, RingBuffer< uint8_t >, RingBufferSPSC< uint8_t >, SingleBuffer< uint8_t >, BufferRP2040T< uint8_t >, and BufferRTOS< uint8_t >.
|
inlineoverride |
reads an entry from the buffer
|
inlineoverride |
reads an entry from the buffer
|
inlinevirtualinherited |
reads multiple values
Reimplemented in AdaptiveResamplingBuffer, NBuffer< uint8_t >, RingBuffer< uint8_t >, RingBufferSPSC< uint8_t >, BufferRP2040T< uint8_t >, and BufferRTOS< uint8_t >.
|
inlineoverride |
Reads up to len entries, spanning across multiple blocks. BaseBuffer::readArray stops at the first block boundary because it calls available() once. This override keeps reading across blocks.
|
inlineoverride |
Reads up to len entries, spanning across multiple blocks. BaseBuffer::readArray stops at the first block boundary because it calls available() once. This override keeps reading across blocks.
|
inlinevirtual |
resets all buffers
Implements BaseBuffer< uint8_t >.
|
inlinevirtual |
resets all buffers
Implements BaseBuffer< uint8_t >.
|
inlineprotected |
|
inlineprotected |
|
inlinevirtual |
Resize the buffer to the next multiple of buffer size.
Reimplemented from BaseBuffer< uint8_t >.
|
inlinevirtual |
Resize the buffer to the next multiple of buffer size.
Reimplemented from BaseBuffer< uint8_t >.
|
inlinevirtual |
Resize the buffers by defining a new buffer size and buffer count. If the block size changes, existing blocks can't be reused, so all buffered data is discarded (with a warning). If only the count changes, existing blocks and their data are kept: buffers are just allocated or freed to reach the new count.
|
inlinevirtual |
Resize the buffers by defining a new buffer size and buffer count. If the block size changes, existing blocks can't be reused, so all buffered data is discarded (with a warning). If only the count changes, existing blocks and their data are kept: buffers are just allocated or freed to reach the new count.
|
inline |
provides the actual sample rate
|
inline |
provides the actual sample rate
|
inlinevirtual |
Provides the total capacity (=buffer size * buffer count).
Implements BaseBuffer< uint8_t >.
Reimplemented in SynchronizedNBufferRTOST< T >, SynchronizedNBufferRTOST< uint8_t >, SynchronizedNBufferZephyrT< T >, and SynchronizedNBufferZephyrT< uint8_t >.
|
inlinevirtual |
Provides the total capacity (=buffer size * buffer count).
Implements BaseBuffer< uint8_t >.
|
pure virtualinherited |
write add an entry to the buffer
Implemented in AdaptiveResamplingBuffer, NBuffer< uint8_t >, RingBuffer< uint8_t >, RingBufferSPSC< uint8_t >, SingleBuffer< uint8_t >, BufferRP2040T< uint8_t >, and BufferRTOS< uint8_t >.
|
inline |
write add an entry to the buffer
|
inline |
write add an entry to the buffer
|
inlinevirtualinherited |
Fills the buffer data.
Reimplemented in AdaptiveResamplingBuffer, RingBuffer< uint8_t >, RingBufferSPSC< uint8_t >, SingleBuffer< uint8_t >, BufferRP2040T< uint8_t >, and BufferRTOS< uint8_t >.
|
inlinevirtualinherited |
Fills the buffer data and overwrites the oldest data if the buffer is full.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |