|
arduino-audio-tools
|
A simple Buffer implementation which just uses a (dynamically sized) array. More...
#include <Buffers.h>
Public Member Functions | |
| SingleBuffer () | |
| Construct a new Single Buffer w/o allocating any memory. | |
| SingleBuffer (int size, Allocator &allocator=DefaultAllocator) | |
| Construct a new Single Buffer object. | |
| SingleBuffer (SingleBuffer &)=default | |
| T * | address () override |
| Provides address to beginning of the buffer. | |
| int | available () override |
| provides the number of entries that are available to read | |
| int | availableForWrite () override |
| provides the number of entries that are available to write | |
| void | clear () |
| same as reset | |
| int | clearArray (int len) override |
| consumes len bytes and moves current data to the beginning | |
| T * | data () |
| Provides address of actual data. | |
| bool | isEmpty () |
| bool | isFull () override |
| checks if the buffer is full | |
| virtual float | levelPercent () |
| Returns the level of the buffer in %. | |
| void | onExternalBufferRefilled (void *data, int len) |
| notifies that the external buffer has been refilled | |
| SingleBuffer & | operator= (SingleBuffer &)=default |
| bool | peek (T &result) override |
| peeks the actual entry from the buffer | |
| int | peekArray (uint8_t *data, int len) |
| bool | read (T &result) override |
| reads a single value | |
| virtual int | readArray (T data[], int len) |
| reads multiple values | |
| void | reset () override |
| clears the buffer | |
| bool | resize (int size) |
| Resizes the buffer if supported: returns false if not supported. | |
| size_t | setAvailable (size_t available_size) |
| void | setClearWithZero (bool flag) |
| Sets the buffer to 0 on clear. | |
| void | setWritePos (int pos) |
| Updates the actual available data size. | |
| size_t | size () override |
| void | trim () |
| Moves the unprocessed data to the beginning of the buffer. | |
| bool | write (T sample) override |
| write add an entry to the buffer | |
| int | writeArray (const T data[], int len) override |
| 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. | |
Public Attributes | |
| bool | active = true |
| Optional active/inactive status. | |
| int | id = 0 |
| Optional ID. | |
| uint64_t | timestamp = 0 |
| Optional timestamp. | |
Protected Attributes | |
| Allocator | _allocator |
| Vector< T > | buffer {0, _allocator} |
| int | current_read_pos = 0 |
| int | current_write_pos = 0 |
| bool | is_clear_with_zero = false |
| bool | owns_buffer = true |
A simple Buffer implementation which just uses a (dynamically sized) array.
|
inline |
Construct a new Single Buffer object.
| size | in entries |
|
inlineoverridevirtual |
Provides address to beginning of the 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 >.
|
inlineoverridevirtual |
consumes len bytes and moves current data to the beginning
Reimplemented from BaseBuffer< 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 >.
|
inline |
If we load values directly into the address we need to set the avialeble size
|
inlineoverridevirtual |
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
write add an entry to the buffer
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
Fills the buffer data.
Reimplemented from BaseBuffer< T >.