arduino-audio-tools
All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Modules Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NBufferExt< T > Class Template Reference

A NBufferExt is a subclass of NBuffer which allows to use a direct access API to the BaseBuffer. More...

#include <Buffers.h>

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

Public Member Functions

 NBufferExt (int size, int count)
 
T * address ()
 returns the address of the start of the phsical read buffer
 
int available ()
 determines the available entries for the current read buffer
 
int availableForWrite ()
 determines the available entries for the write buffer
 
virtual int bufferCountEmpty ()
 Provides the number of entries that are available to write.
 
virtual int bufferCountFilled ()
 Provides the number of entries that are available to read.
 
void clear ()
 same as reset
 
virtual int clearArray (int len)
 Removes the next len entries.
 
SingleBuffer< T > * getBuffer (int id)
 Provides the buffer with the indicated id.
 
bool isEmpty ()
 
bool isFull ()
 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 &result) override
 reads an entry from the buffer
 
virtual int readArray (T data[], int len)
 reads multiple values
 
SingleBuffer< T > * readEnd ()
 Alternative interface using address: provides access to the next read buffer.
 
void reset ()
 resets all buffers
 
virtual void resize (int size, int count)
 Resize the buffers by defining a new buffer size and buffer count.
 
unsigned long sampleRate ()
 provides the actual sample rate
 
size_t size ()
 Provides the total capacity (=buffer size * buffer count)
 
bool write (T data)
 write add an entry to the buffer
 
virtual 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.
 
SingleBuffer< T > * writeEnd ()
 

Protected Member Functions

virtual bool addAvailableBuffer (BaseBuffer< T > *buffer)
 
virtual bool addFilledBuffer (BaseBuffer< T > *buffer)
 
void freeMemory ()
 
virtual BaseBuffer< T > * getNextAvailableBuffer ()
 
virtual BaseBuffer< T > * getNextFilledBuffer ()
 
void resetCurrent ()
 

Protected Attributes

BaseBuffer< T > * actual_read_buffer = nullptr
 
BaseBuffer< T > * actual_write_buffer = nullptr
 
QueueFromVector< BaseBuffer< T > * > available_buffers {0, nullptr}
 
uint16_t buffer_count = 0
 
int buffer_size = 0
 
QueueFromVector< BaseBuffer< T > * > filled_buffers {0, nullptr}
 
unsigned long sample_count = 0
 
unsigned long start_time = 0
 

Detailed Description

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

A NBufferExt is a subclass of NBuffer which allows to use a direct access API to the BaseBuffer.

Template Parameters
Tbuffered data type

Member Function Documentation

◆ address()

template<typename T >
T * address ( )
inlinevirtualinherited

returns the address of the start of the phsical read buffer

Implements BaseBuffer< T >.

◆ available()

template<typename T >
int available ( )
inlinevirtualinherited

determines the available entries for the current read buffer

Implements BaseBuffer< T >.

◆ availableForWrite()

template<typename T >
int availableForWrite ( )
inlinevirtualinherited

determines the available entries for the write buffer

Implements BaseBuffer< T >.

◆ bufferCountEmpty()

template<typename T >
virtual int bufferCountEmpty ( )
inlinevirtualinherited

Provides the number of entries that are available to write.

Reimplemented in SynchronizedNBufferRTOST< T >.

◆ bufferCountFilled()

template<typename T >
virtual int bufferCountFilled ( )
inlinevirtualinherited

Provides the number of entries that are available to read.

Reimplemented in SynchronizedNBufferRTOST< T >.

◆ clearArray()

template<typename T >
virtual int clearArray ( int  len)
inlinevirtualinherited

Removes the next len entries.

Reimplemented in SingleBuffer< T >, SingleBuffer< int16_t >, and SingleBuffer< uint8_t >.

◆ isFull()

template<typename T >
bool isFull ( )
inlinevirtualinherited

checks if the buffer is full

Reimplemented from BaseBuffer< T >.

◆ peek()

template<typename T >
bool peek ( T &  result)
inlineoverridevirtualinherited

peeks the actual entry from the buffer

Implements BaseBuffer< T >.

◆ read()

template<typename T >
bool read ( T &  result)
inlineoverridevirtualinherited

reads an entry from the buffer

Implements BaseBuffer< T >.

◆ readArray()

template<typename T >
virtual int readArray ( data[],
int  len 
)
inlinevirtualinherited

◆ reset()

template<typename T >
void reset ( )
inlinevirtualinherited

resets all buffers

Implements BaseBuffer< T >.

◆ resize()

template<typename T >
virtual void resize ( int  size,
int  count 
)
inlinevirtualinherited

Resize the buffers by defining a new buffer size and buffer count.

Reimplemented in SynchronizedNBufferRTOST< T >.

◆ size()

template<typename T >
size_t size ( )
inlinevirtualinherited

Provides the total capacity (=buffer size * buffer count)

Implements BaseBuffer< T >.

Reimplemented in SynchronizedNBufferRTOST< T >.

◆ write()

template<typename T >
bool write ( data)
inlinevirtualinherited

write add an entry to the buffer

Implements BaseBuffer< T >.

◆ writeArray()

template<typename T >
virtual int writeArray ( const T  data[],
int  len 
)
inlinevirtualinherited

◆ writeEnd()

template<typename T >
SingleBuffer< T > * writeEnd ( )
inline

Alternative interface: Provides access to the next write buffer


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