arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
audio_tools::NBuffer< T > Class Template Reference

A lock free N buffer. If count=2 we create a DoubleBuffer, if count=3 a TripleBuffer etc. More...

#include <Buffers.h>

Inheritance diagram for audio_tools::NBuffer< T >:
audio_tools::BaseBuffer< T >

Public Member Functions

 NBuffer (int size=512, int count=2)
 
T * address ()
 
int available ()
 
int availableForWrite ()
 
bool isFull ()
 
peek ()
 
read ()
 
BaseBuffer< T > & readEnd ()
 
void reset ()
 
unsigned long sampleRate ()
 
bool write (T data)
 
BaseBuffer< T > & writeEnd ()
 
- Public Member Functions inherited from audio_tools::BaseBuffer< T >
 BaseBuffer (BaseBuffer const &)=delete
 
virtual T * address ()=0
 
virtual int available ()=0
 
virtual int availableForWrite ()=0
 
bool isEmpty ()
 
virtual bool isFull ()=0
 
BaseBufferoperator= (BaseBuffer const &)=delete
 
virtual T peek ()=0
 
virtual T read ()=0
 
int readArray (T data[], int len)
 
int readFrames (T data[][2], int len)
 
template<int rows, int channels>
int readFrames (T(&data)[rows][channels])
 
virtual void reset ()=0
 
virtual bool write (T data)=0
 
int writeArray (const T data[], int len)
 

Protected Member Functions

bool addAvailableBuffer (BaseBuffer< T > *buffer)
 
bool addFilledBuffer (BaseBuffer< T > *buffer)
 
BaseBuffer< T > * getNextAvailableBuffer ()
 
BaseBuffer< T > * getNextFilledBuffer ()
 
void resetCurrent ()
 
- Protected Member Functions inherited from audio_tools::BaseBuffer< T >
void setWritePos (int pos)
 

Protected Attributes

BaseBuffer< T > * actual_read_buffer = nullptr
 
BaseBuffer< T > * actual_write_buffer = nullptr
 
BaseBuffer< T > ** avaliable_buffers = nullptr
 
uint16_t buffer_count = 0
 
int buffer_size = 0
 
BaseBuffer< T > ** filled_buffers = nullptr
 
unsigned long sample_count = 0
 
unsigned long start_time = 0
 
uint16_t write_buffer_count = 0
 
- Protected Attributes inherited from audio_tools::BaseBuffer< T >
friend NBuffer< T >
 

Detailed Description

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

A lock free N buffer. If count=2 we create a DoubleBuffer, if count=3 a TripleBuffer etc.

Author
Phil Schatzmann

Member Function Documentation

◆ address()

template<typename T >
T * audio_tools::NBuffer< T >::address ( )
inlinevirtual

◆ available()

template<typename T >
int audio_tools::NBuffer< T >::available ( )
inlinevirtual

◆ availableForWrite()

template<typename T >
int audio_tools::NBuffer< T >::availableForWrite ( )
inlinevirtual

◆ isFull()

template<typename T >
bool audio_tools::NBuffer< T >::isFull ( )
inlinevirtual

◆ peek()

template<typename T >
T audio_tools::NBuffer< T >::peek ( )
inlinevirtual

◆ read()

template<typename T >
T audio_tools::NBuffer< T >::read ( )
inlinevirtual

◆ reset()

template<typename T >
void audio_tools::NBuffer< T >::reset ( )
inlinevirtual

◆ write()

template<typename T >
bool audio_tools::NBuffer< T >::write ( data)
inlinevirtual

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