arduino-audio-tools
|
Implements a typed Ringbuffer. More...
#include <Buffers.h>
Public Member Functions | |
RingBuffer (int size) | |
virtual T * | address () |
returns the address of the start of the physical read buffer | |
virtual int | available () |
provides the number of entries that are available to read | |
virtual int | availableForWrite () |
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 () |
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 () |
clears the buffer | |
virtual void | resize (int len) |
virtual size_t | size () |
Returns the maximum capacity of the buffer. | |
virtual bool | write (T data) |
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) |
void | setWritePos (int pos) |
Protected Attributes | |
Vector< T > | _aucBuffer |
int | _iHead |
int | _iTail |
int | _numElems |
int | max_size = 0 |
friend | NBuffer< T > |
Implements a typed Ringbuffer.
T |
|
inlinevirtual |
returns the address of the start of the physical read buffer
Implements BaseBuffer< T >.
|
inlinevirtual |
provides the number of entries that are available to read
Implements BaseBuffer< T >.
|
inlinevirtual |
provides the number of entries that are available to write
Implements BaseBuffer< T >.
|
inlinevirtualinherited |
Removes the next len entries.
Reimplemented in SingleBuffer< T >, SingleBuffer< int16_t >, and SingleBuffer< uint8_t >.
|
inlinevirtual |
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 >, BufferRP2040T< T >, and NBufferFile< File, T >.
|
inlinevirtual |
clears the buffer
Implements BaseBuffer< T >.
|
inlinevirtual |
Returns the maximum capacity of the buffer.
Implements BaseBuffer< T >.
|
inlinevirtual |
write add an entry to the buffer
Implements BaseBuffer< T >.
|
inlinevirtualinherited |
Fills the buffer data.
Reimplemented in BufferRTOS< T >, SynchronizedBuffer< T >, BufferRP2040T< T >, RingBufferFile< File, T >, and NBufferFile< File, T >.