Buffer implementation which provides the same blocking, thread-safe semantics as BufferRTOS (ESP32/STM32) and BufferZephyr, for platforms that have no native blocking stream buffer primitive - built on a SpinLock-protected RingBuffer plus a delay(1) polling wait loop.
More...
#include <BufferBlocking.h>
template<typename T>
class audio_tools::BufferBlocking< T >
Buffer implementation which provides the same blocking, thread-safe semantics as BufferRTOS (ESP32/STM32) and BufferZephyr, for platforms that have no native blocking stream buffer primitive - built on a SpinLock-protected RingBuffer plus a delay(1) polling wait loop.
- Note
- Supported on any platform providing MutexBase, delay() and millis() (e.g. Desktop, RP2040 without FreeRTOS)
- Author
- Phil Schatzmann
- Copyright
- GPLv3
- Template Parameters
-
◆ BufferBlocking()
◆ address()
returns the address of the start of the physical read buffer
Implements BaseBuffer< T >.
◆ available()
provides the number of entries that are available to read
Implements BaseBuffer< T >.
◆ availableForWrite()
template<typename T>
| int availableForWrite |
( |
| ) |
|
|
inlineoverridevirtual |
provides the number of entries that are available to write
Implements BaseBuffer< T >.
◆ bufferCountEmpty()
| virtual int bufferCountEmpty |
( |
| ) |
|
|
inlinevirtualinherited |
◆ bufferCountFilled()
| virtual int bufferCountFilled |
( |
| ) |
|
|
inlinevirtualinherited |
◆ clear()
◆ clearArray()
| virtual int clearArray |
( |
int | len | ) |
|
|
inlinevirtualinherited |
◆ flush()
Submit any partially-filled write buffer so the reader can access it. Only meaningful for NBuffer-style block pools; no-op for ring buffers.
Reimplemented in NBuffer< T >.
◆ freePercent()
| virtual float freePercent |
( |
| ) |
|
|
inlinevirtualinherited |
Returns the free space of the buffer in %.
◆ isEmpty()
◆ isFull()
◆ isTimeLeft()
template<typename T>
| bool isTimeLeft |
( |
uint32_t | start, |
|
|
TickType_t | maxWait ) |
|
inlineprotected |
◆ levelPercent()
| virtual float levelPercent |
( |
| ) |
|
|
inlinevirtualinherited |
Returns the level of the buffer in %.
◆ operator bool()
◆ peek()
◆ read()
◆ readArray()
template<typename T>
| int readArray |
( |
T | data[], |
|
|
int | len ) |
|
inlinevirtual |
◆ reset()
◆ resize()
template<typename T>
| bool resize |
( |
size_t | size | ) |
|
|
inlinevirtual |
Re-Allocates the memory of the ring buffer.
Reimplemented from BaseBuffer< T >.
◆ setReadFromISR()
template<typename T>
| void setReadFromISR |
( |
bool | active | ) |
|
|
inline |
◆ setReadMaxWait()
◆ setWriteFromISR()
template<typename T>
| void setWriteFromISR |
( |
bool | active | ) |
|
|
inline |
◆ setWriteMaxWait()
◆ size()
◆ write()
◆ writeArray()
template<typename T>
| int writeArray |
( |
const T | data[], |
|
|
int | len ) |
|
inlinevirtual |
◆ writeArrayOverwrite()
| virtual int writeArrayOverwrite |
( |
const T | data[], |
|
|
int | len ) |
|
inlinevirtualinherited |
Fills the buffer data and overwrites the oldest data if the buffer is full.
◆ buffer
◆ mutex
◆ readWait
◆ writeWait
The documentation for this class was generated from the following file: