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

Stream class which stores the data in a temporary queue buffer. The queue can be consumed e.g. by a callback function by calling readBytes();. More...

#include <BaseStream.h>

Inheritance diagram for QueueStream< T >:
BaseStream Stream Print

Public Member Functions

 QueueStream (BaseBuffer< T > &buffer)
 Create stream from any BaseBuffer subclass.
 
 QueueStream (int bufferSize, int bufferCount, bool autoRemoveOldestDataIfFull=false)
 Default constructor.
 
int available () override
 
int availableForWrite () override
 
virtual bool begin ()
 Activates the output.
 
virtual bool begin (size_t activeWhenPercentFilled)
 Activate only when filled buffer reached %.
 
void clear ()
 Clears the data in the buffer.
 
virtual void end ()
 stops the processing
 
virtual void flush () override
 
 operator bool ()
 Returns true if active.
 
virtual size_t readBytes (uint8_t *data, size_t len) override
 
virtual size_t write (const uint8_t *data, size_t len) override
 
virtual size_t write (uint8_t ch) override
 

Protected Member Functions

void refillReadBuffer ()
 

Protected Attributes

int _timeout = 10
 
bool active
 
size_t active_limit = 0
 
BaseBuffer< T > * callback_buffer_ptr
 
bool owns_buffer
 
bool remove_oldest_data
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_out {0}
 

Detailed Description

template<class T>
class audio_tools::QueueStream< T >

Stream class which stores the data in a temporary queue buffer. The queue can be consumed e.g. by a callback function by calling readBytes();.

Author
Phil Schatzmann

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