|
arduino-audio-tools
|
Buffer implementation which is based on a RP2040 queue. This class is intended to be used to exchange data between the 2 different cores. Multi-core and IRQ safe queue implementation! More...
#include <BufferRP2040.h>
Public Member Functions | |
| BufferRP2040T (int bufferCount) | |
| BufferRP2040T (size_t bufferSize, int bufferCount) | |
| ~BufferRP2040T () | |
| T * | address () override |
| returns the address of the start of the physical read 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 | |
| virtual int | clearArray (int len) |
| Removes the next len entries. | |
| bool | isEmpty () |
| 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 | |
| bool | read (T &data) |
| reads a single value | |
| int | readArray (T data[], int len) override |
| reads multiple values | |
| void | reset () override |
| clears the buffer | |
| virtual bool | resize (int bytes) |
| Resizes the buffer if supported: returns false if not supported. | |
| bool | resize (size_t size) |
| Re-Allocats the memory and the queue (size is in entries) | |
| void | setBlockingRead (bool flag) |
| When we use a blockingread, the we wait for the data to be available. | |
| void | setBlockingWrite (bool flag) |
| When we use a non blocking write, the write size must be identical with the buffer size. | |
| size_t | size () |
| bool | write (T data) 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. | |
Protected Member Functions | |
| int | writeBlocking (const T data[], int len) |
| int | writeNonBlocking (const T data[], int len) |
Protected Attributes | |
| int | buffer_size = 0 |
| int | buffer_size_alloc_bytes = 0 |
| int | buffer_size_bytes = 0 |
| int | buffer_size_req_bytes = 0 |
| bool | is_blocking_read = false |
| bool | is_blocking_write = true |
| queue_t | queue |
| audio_tools::RingBuffer< T > | read_buffer {0} |
| SingleBuffer< T > | write_buffer {0} |
Buffer implementation which is based on a RP2040 queue. This class is intended to be used to exchange data between the 2 different cores. Multi-core and IRQ safe queue implementation!
In order to increase the efficiency we to not enqueue individual items but write them into a temporary buffer of bufferSize and write this array to the queue when it is full.
| T |
|
inline |
|
inline |
|
inline |
returns the address of the start of the physical read buffer
Implements BaseBuffer< T >.
provides the number of entries that are available to read
Implements BaseBuffer< T >.
provides the number of entries that are available to write
Implements BaseBuffer< T >.
|
inlineinherited |
same as reset
Removes the next len entries.
Reimplemented in SingleBuffer< T >.
checks if the buffer is full
Reimplemented from BaseBuffer< T >.
peeks the actual entry from the buffer
Implements BaseBuffer< T >.
reads a single value
Implements BaseBuffer< T >.
reads multiple values
Reimplemented from BaseBuffer< T >.
clears the buffer
Implements BaseBuffer< T >.
Resizes the buffer if supported: returns false if not supported.
Reimplemented in NBuffer< T >, RingBuffer< T >, DynamicMultiBuffer< T, BufferType >, SingleBuffer< T >, RingBufferFile< File, T >, and RedisBuffer< T >.
Re-Allocats the memory and the queue (size is in entries)
When we use a blockingread, the we wait for the data to be available.
When we use a non blocking write, the write size must be identical with the buffer size.
Implements BaseBuffer< T >.
write add an entry to the buffer
Implements BaseBuffer< T >.
Fills the buffer data.
Reimplemented from BaseBuffer< T >.
Fills the buffer data and overwrites the oldest data if the buffer is full.
|
protected |
|
protected |