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

Wrapper class that can turn any Buffer into a thread save implementation. More...

#include <SynchronizedBuffers.h>

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

Public Member Functions

 SynchronizedBuffer (BaseBuffer< T > &buffer, Mutex &mutex)
 
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
 
peek () override
 peeks the actual entry from the buffer
 
read () override
 reads a single value
 
int readArray (T data[], int len)
 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
 
size_t size ()
 
bool write (T data) override
 write add an entry to the buffer
 
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

void setWritePos (int pos)
 

Protected Attributes

friend NBuffer< T >
 
BaseBuffer< T > * p_buffer = nullptr
 
Mutexp_mutex = nullptr
 

Detailed Description

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

Wrapper class that can turn any Buffer into a thread save implementation.

Author
Phil Schatzmann
Template Parameters
T

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