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
DynamicMemoryStream Class Reference

MemoryStream which is written and read using the internal RAM. For each write the data is allocated on the heap. More...

#include <BaseStream.h>

Inheritance diagram for DynamicMemoryStream:
BaseStream Stream Print

Public Member Functions

 DynamicMemoryStream (bool isLoop, int defaultBufferSize=DEFAULT_BUFFER_SIZE)
 
void assign (DynamicMemoryStream &ref)
 
virtual int available () override
 
virtual int availableForWrite () override
 
virtual bool begin () override
 Intializes the processing.
 
void clear ()
 
virtual void end () override
 
virtual void flush () override
 
List< DataNode * > & list ()
 
 operator bool ()
 
template<typename T >
void postProcessSmoothTransition (int channels, float factor=0.01, int remove=0)
 Post processing after the recording. We add a smooth transition at the beginning and at the end.
 
virtual size_t readBytes (uint8_t *data, size_t len) override
 
void rewind ()
 Sets the read position to the beginning.
 
virtual void setLoop (bool loop)
 Automatically rewinds to the beginning when reaching the end.
 
size_t size ()
 
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 alloc_failed = false
 
List< DataNode * > audio_list
 
int default_buffer_size =DEFAULT_BUFFER_SIZE
 
bool is_loop = false
 
List< DataNode * >::Iterator it = audio_list.end()
 
RingBuffer< uint8_t > temp_audio {DEFAULT_BUFFER_SIZE}
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_out {0}
 
size_t total_available =0
 

Detailed Description

MemoryStream which is written and read using the internal RAM. For each write the data is allocated on the heap.

Author
Phil Schatzmann

Member Function Documentation

◆ available()

virtual int available ( )
inlineoverridevirtual

Reimplemented from BaseStream.

◆ availableForWrite()

virtual int availableForWrite ( )
inlineoverridevirtual

Reimplemented from BaseStream.

◆ begin()

virtual bool begin ( )
inlineoverridevirtual

Intializes the processing.

Reimplemented from BaseStream.

◆ end()

virtual void end ( )
inlineoverridevirtual

Reimplemented from BaseStream.

◆ flush()

virtual void flush ( )
inlineoverridevirtualinherited

Reimplemented from Print.

Reimplemented in ResampleStream, BufferedTaskStream, and BufferedStream.

◆ postProcessSmoothTransition()

template<typename T >
void postProcessSmoothTransition ( int  channels,
float  factor = 0.01,
int  remove = 0 
)
inline

Post processing after the recording. We add a smooth transition at the beginning and at the end.

Template Parameters
T
Parameters
factor

◆ readBytes()

virtual size_t readBytes ( uint8_t *  data,
size_t  len 
)
inlineoverridevirtual

Implements BaseStream.

◆ write() [1/2]

virtual size_t write ( const uint8_t *  data,
size_t  len 
)
inlineoverridevirtual

Implements BaseStream.

◆ write() [2/2]

virtual size_t write ( uint8_t  ch)
inlineoverridevirtualinherited

Reimplemented in BufferedTaskStream, and BufferedStream.


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