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

ConverterStream Helper class which implements the readBytes with the help of write. More...

#include <AudioIO.h>

Public Member Functions

int available ()
 
void begin (T *transform, Stream *source)
 setup of the TransformationReader class
 
void end ()
 
size_t getTotalBytesRead () const
 
size_t readBytes (uint8_t *data, size_t len)
 
void resizeResultQueue (int size)
 Defines the queue size for result.
 
void setMaxReadSize (int size)
 
void setResultQueueFactor (int factor)
 Defines the queue size dependent on the read size.
 

Protected Member Functions

void fillResultQueue (size_t len)
 
void resizeReadBuffer (int size)
 Defines the read buffer size for individual reads.
 
void restoreOutput (Print *out)
 restores the original output in the converter class
 
void setupBuffers (size_t len)
 
PrintsetupOutput ()
 

Protected Attributes

bool active = false
 
Vector< uint8_tbuffer {0}
 
bool is_eof = false
 
int last_setup_buffer_size = 0
 
int max_read_size = DEFAULT_BUFFER_SIZE
 
Streamp_stream = nullptr
 
Tp_transform = nullptr
 
QueueStream< uint8_tresult_queue {result_queue_buffer}
 
RingBuffer< uint8_tresult_queue_buffer {0}
 
int result_queue_factor = 5
 
size_t total_bytes_read = 0
 

Detailed Description

template<class T>
class audio_tools::TransformationReader< T >

ConverterStream Helper class which implements the readBytes with the help of write.

Author
Phil Schatzmann
Template Parameters
Tclass name of the original transformer stream

Member Function Documentation

◆ available()

template<class T >
int available ( )
inline

Fills the internal queue up to at least DEFAULT_BUFFER_SIZE bytes (if possible) and reports the currently available queue size limited by max_read_size.

◆ begin()

template<class T >
void begin ( T transform,
Stream source 
)
inline

setup of the TransformationReader class

Parameters
transformThe original transformer stream
sourceThe data source of the data to be converted the requested converted bytes

◆ end()

template<class T >
void end ( )
inline

◆ fillResultQueue()

template<class T >
void fillResultQueue ( size_t  len)
inlineprotected

Fills the result queue until at least len bytes are available or no more input data arrives.

◆ getTotalBytesRead()

template<class T >
size_t getTotalBytesRead ( ) const
inline

◆ readBytes()

template<class T >
size_t readBytes ( uint8_t data,
size_t  len 
)
inline

◆ resizeReadBuffer()

template<class T >
void resizeReadBuffer ( int  size)
inlineprotected

Defines the read buffer size for individual reads.

◆ resizeResultQueue()

template<class T >
void resizeResultQueue ( int  size)
inline

Defines the queue size for result.

◆ restoreOutput()

template<class T >
void restoreOutput ( Print out)
inlineprotected

restores the original output in the converter class

Parameters
out

◆ setMaxReadSize()

template<class T >
void setMaxReadSize ( int  size)
inline

◆ setResultQueueFactor()

template<class T >
void setResultQueueFactor ( int  factor)
inline

Defines the queue size dependent on the read size.

◆ setupBuffers()

template<class T >
void setupBuffers ( size_t  len)
inlineprotected

◆ setupOutput()

template<class T >
Print * setupOutput ( )
inlineprotected

Makes sure that the data is written to the array

Parameters
data
Returns
original output of the converter class

Member Data Documentation

◆ active

template<class T >
bool active = false
protected

◆ buffer

template<class T >
Vector<uint8_t> buffer {0}
protected

◆ is_eof

template<class T >
bool is_eof = false
protected

◆ last_setup_buffer_size

template<class T >
int last_setup_buffer_size = 0
protected

◆ max_read_size

template<class T >
int max_read_size = DEFAULT_BUFFER_SIZE
protected

◆ p_stream

template<class T >
Stream* p_stream = nullptr
protected

◆ p_transform

template<class T >
T* p_transform = nullptr
protected

◆ result_queue

template<class T >
QueueStream<uint8_t> result_queue {result_queue_buffer}
protected

◆ result_queue_buffer

template<class T >
RingBuffer<uint8_t> result_queue_buffer {0}
protected

◆ result_queue_factor

template<class T >
int result_queue_factor = 5
protected

◆ total_bytes_read

template<class T >
size_t total_bytes_read = 0
protected

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