arduino-audio-tools
Classes | Public Member Functions | Protected Attributes | List of all members
audio_tools::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 <AudioStreams.h>

Inheritance diagram for audio_tools::DynamicMemoryStream:
audio_tools::AudioStreamX audio_tools::AudioStream Stream audio_tools::AudioBaseInfoDependent audio_tools::AudioBaseInfoSource Print

Classes

struct  DataNode
 

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
 
List< DataNode * > & list ()
 
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. More...
 
virtual size_t readBytes (uint8_t *buffer, size_t length) override
 
void rewind ()
 Sets the read position to the beginning.
 
virtual void setLoop (bool loop)
 
size_t size ()
 
virtual size_t write (const uint8_t *buffer, size_t size) override
 
- Public Member Functions inherited from audio_tools::AudioStreamX
virtual void flush () FLUSH_OVERRIDE
 
virtual int peek () override
 
virtual int read () override
 
virtual size_t write (uint8_t) override
 
- Public Member Functions inherited from audio_tools::AudioStream
virtual AudioBaseInfo audioInfo ()
 
 operator bool ()
 
virtual size_t readBytes (char *buffer, size_t length)
 
virtual void setAudioInfo (AudioBaseInfo info)
 
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi)
 
- Public Member Functions inherited from Stream
bool find (char target)
 
bool find (const char *target)
 
bool find (const char *target, size_t length)
 
bool find (const uint8_t *target)
 
bool find (const uint8_t *target, size_t length)
 
bool findUntil (const char *target, const char *terminator)
 
bool findUntil (const char *target, size_t targetLen, const char *terminate, size_t termLen)
 
bool findUntil (const uint8_t *target, const char *terminator)
 
bool findUntil (const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen)
 
unsigned long getTimeout (void)
 
float parseFloat (LookaheadMode lookahead=SKIP_ALL, char ignore=NO_IGNORE_CHAR)
 
long parseInt (LookaheadMode lookahead=SKIP_ALL, char ignore=NO_IGNORE_CHAR)
 
size_t readBytes (char *buffer, size_t length)
 
size_t readBytes (uint8_t *buffer, size_t length)
 
size_t readBytesUntil (char terminator, char *buffer, size_t length)
 
size_t readBytesUntil (char terminator, uint8_t *buffer, size_t length)
 
String readString ()
 
String readStringUntil (char terminator)
 
void setTimeout (unsigned long timeout)
 
- Public Member Functions inherited from Print
void clearWriteError ()
 
int getWriteError ()
 
size_t print (char)
 
size_t print (const __FlashStringHelper *)
 
size_t print (const char[])
 
size_t print (const Printable &)
 
size_t print (const String &)
 
size_t print (double, int=2)
 
size_t print (int, int=DEC)
 
size_t print (long long, int=DEC)
 
size_t print (long, int=DEC)
 
size_t print (unsigned char, int=DEC)
 
size_t print (unsigned int, int=DEC)
 
size_t print (unsigned long long, int=DEC)
 
size_t print (unsigned long, int=DEC)
 
size_t println (char)
 
size_t println (const __FlashStringHelper *)
 
size_t println (const char[])
 
size_t println (const Printable &)
 
size_t println (const String &s)
 
size_t println (double, int=2)
 
size_t println (int, int=DEC)
 
size_t println (long long, int=DEC)
 
size_t println (long, int=DEC)
 
size_t println (unsigned char, int=DEC)
 
size_t println (unsigned int, int=DEC)
 
size_t println (unsigned long long, int=DEC)
 
size_t println (unsigned long, int=DEC)
 
size_t println (void)
 
size_t write (const char *buffer, size_t size)
 
size_t write (const char *str)
 
- Public Member Functions inherited from audio_tools::AudioBaseInfoDependent
virtual bool validate (AudioBaseInfo &info)
 

Protected Attributes

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}
 
size_t total_available =0
 
- Protected Attributes inherited from audio_tools::AudioStream
AudioBaseInfo info
 
AudioBaseInfoDependentp_notify =nullptr
 
- Protected Attributes inherited from Stream
unsigned long _startMillis
 
unsigned long _timeout
 

Additional Inherited Members

- Protected Member Functions inherited from audio_tools::AudioStream
virtual int not_supported (int out)
 
- Protected Member Functions inherited from Stream
int findMulti (struct MultiTarget *targets, int tCount)
 
float parseFloat (char ignore)
 
long parseInt (char ignore)
 
int peekNextDigit (LookaheadMode lookahead, bool detectDecimal)
 
int timedPeek ()
 
int timedRead ()
 
- Protected Member Functions inherited from Print
void setWriteError (int err=1)
 

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

◆ postProcessSmoothTransition()

template<typename T >
void audio_tools::DynamicMemoryStream::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

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