arduino-audio-tools
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BufferRP2040T< T > Class Template Reference

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>

Inheritance diagram for BufferRP2040T< T >:
BaseBuffer< T >

Public Member Functions

 BufferRP2040T (size_t bufferSize, int bufferCount=2)
 
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 %.
 
peek ()
 peeks the actual entry from the buffer
 
read ()
 reads a single value
 
int readArray (T data[], int len) override
 reads multiple values
 
int readFrames (T data[][2], int len)
 reads multiple values for array of 2 dimensional frames
 
template<int rows, int channels>
int readFrames (T(&data)[rows][channels])
 
void reset () override
 clears the buffer
 
bool resize (size_t size)
 Re-Allocats the memory and the queue.
 
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

void setWritePos (int pos)
 
int writeBlocking (const T data[], int len)
 
int writeNonBlocking (const T data[], int len)
 

Protected Attributes

int buffer_size = 0
 
int buffer_size_req_bytes = 0
 
int buffer_size_total_bytes = 0
 
bool is_blocking_write = true
 
friend NBuffer< T >
 
queue_t queue
 
audio_tools::RingBuffer< T > read_buffer {0}
 
SingleBuffer< T > write_buffer {0}
 

Detailed Description

template<typename T>
class audio_tools::BufferRP2040T< T >

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!

Author
Phil Schatzmann
Template Parameters
T

The documentation for this class was generated from the following file: