|
arduino-audio-tools
|
Implements a typed Ringbuffer. More...
#include <Buffers.h>
Public Member Functions | |
| RingBuffer (int size, Allocator &allocator=DefaultAllocator) | |
| virtual T * | address () override |
| returns the address of the start of the physical read buffer | |
| virtual int | available () override |
| provides the number of entries that are available to read | |
| virtual int | availableForWrite () override |
| provides the number of entries that are available to write | |
| void | clear () |
| same as reset | |
| virtual int | clearArray (int len) |
| Removes the next len entries. | |
| bool | isEmpty () |
| virtual bool | isFull () override |
| checks if the buffer is full | |
| virtual float | levelPercent () |
| Returns the level of the buffer in %. | |
| bool | peek (T &result) override |
| peeks the actual entry from the buffer | |
| virtual int | peekArray (T *data, int n) |
| bool | read (T &result) override |
| reads a single value | |
| virtual int | readArray (T data[], int len) |
| reads multiple values | |
| virtual void | reset () override |
| clears the buffer | |
| virtual bool | resize (int len) |
| Resizes the buffer if supported: returns false if not supported. | |
| virtual size_t | size () override |
| Returns the maximum capacity of the buffer. | |
| virtual bool | write (T data) override |
| write add an entry to the buffer | |
| virtual int | writeArray (const T data[], int len) |
| Fills the buffer data. | |
| virtual int | writeArrayOverwrite (const T data[], int len) |
| Fills the buffer data and overwrites the oldest data if the buffer is full. | |
Protected Member Functions | |
| int | nextIndex (int index) |
Protected Attributes | |
| Allocator & | _allocator |
| Vector< T > | _aucBuffer {_allocator} |
| int | _iHead |
| int | _iTail |
| int | _numElems |
| int | max_size = 0 |
Implements a typed Ringbuffer.
| T |
|
inlineoverridevirtual |
returns the address of the start of the physical read buffer
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
provides the number of entries that are available to read
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
provides the number of entries that are available to write
Implements BaseBuffer< T >.
|
inlinevirtualinherited |
Removes the next len entries.
Reimplemented in SingleBuffer< T >, SingleBuffer< float >, SingleBuffer< int16_t >, SingleBuffer< int32_t >, SingleBuffer< stsz_sample_size_t >, SingleBuffer< T >, SingleBuffer< uint32_t >, and SingleBuffer< uint8_t >.
|
inlineoverridevirtual |
checks if the buffer is full
Reimplemented from BaseBuffer< T >.
|
inlineoverridevirtual |
peeks the actual entry from the buffer
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
reads a single value
Implements BaseBuffer< T >.
|
inlinevirtualinherited |
reads multiple values
Reimplemented in RingBufferFile< File, T >, BufferRTOS< T >, SynchronizedBuffer< T >, RedisBuffer< T >, BufferRP2040T< T >, NBufferFile< File, T >, and DynamicMultiBuffer< T, BufferType >.
|
inlineoverridevirtual |
clears the buffer
Implements BaseBuffer< T >.
|
inlinevirtual |
Resizes the buffer if supported: returns false if not supported.
Reimplemented from BaseBuffer< T >.
|
inlineoverridevirtual |
Returns the maximum capacity of the buffer.
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
write add an entry to the buffer
Implements BaseBuffer< T >.
|
inlinevirtualinherited |
Fills the buffer data.
Reimplemented in BufferRTOS< T >, SynchronizedBuffer< T >, RedisBuffer< T >, BufferRP2040T< T >, SingleBuffer< T >, SingleBuffer< T >, RingBufferFile< File, T >, NBufferFile< File, T >, and DynamicMultiBuffer< T, BufferType >.