arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
audio_tools::EncodedAudioStream Class Reference

A more natural Stream class to process encoded data (aac, wav, mp3...). More...

#include <AudioEncoded.h>

Inheritance diagram for audio_tools::EncodedAudioStream:
audio_tools::AudioPrint Print audio_tools::AudioBaseInfoDependent audio_tools::AudioBaseInfoSource

Public Member Functions

 EncodedAudioStream ()
 Construct a new Encoded Audio Stream object - the Output and Encoder/Decoder needs to be defined with the begin method. More...
 
 EncodedAudioStream (AudioPrint *outputStream, AudioDecoder *decoder)
 Constructor for AudioPrint with automatic notification of audio changes.
 
 EncodedAudioStream (AudioStream *outputStream, AudioDecoder *decoder)
 Constructor for AudioStream with automatic notification of audio changes.
 
 EncodedAudioStream (Print &outputStream, AudioDecoder &decoder)
 Construct a new Encoded Stream object - used for decoding. More...
 
 EncodedAudioStream (Print &outputStream, AudioEncoder &encoder)
 Construct a new Encoded Audio Stream object - used for encoding. More...
 
 EncodedAudioStream (Print *outputStream, AudioDecoder *decoder)
 Construct a new Encoded Audio Stream object - used for decoding. More...
 
 EncodedAudioStream (Print *outputStream, AudioEncoder *encoder)
 Construct a new Encoded Audio Stream object - used for encoding. More...
 
virtual ~EncodedAudioStream ()
 Destroy the Encoded Audio Stream object. More...
 
int availableForWrite () override
 
void begin ()
 Starts the processing - sets the status to active.
 
void begin (AudioBaseInfo info)
 Starts the processing - sets the status to active.
 
void begin (Print *outputStream, AudioDecoder *decoder)
 Starts the processing - sets the status to active.
 
void begin (Print *outputStream, AudioEncoder *encoder)
 Starts the processing - sets the status to active.
 
AudioDecoderdecoder ()
 Provides the initialized decoder.
 
AudioBaseInfo defaultConfig ()
 
AudioEncoderencoder ()
 Provides the initialized encoder.
 
void end ()
 Ends the processing.
 
 operator bool ()
 Returns true if status is active and we still have data to be processed.
 
virtual void setAudioInfo (AudioBaseInfo info) override
 
void setNotifyAudioChange (AudioBaseInfoDependent &bi) override
 Define object which need to be notified if the basinfo is changing. More...
 
virtual size_t write (const uint8_t *data, size_t len) override
 encode the data More...
 
- Public Member Functions inherited from audio_tools::AudioPrint
virtual AudioBaseInfo audioInfo () override
 
virtual int availableForWrite ()
 
virtual bool doRelease ()
 If true we need to release the related memory. More...
 
void flush ()
 
virtual void setAudioInfo (AudioBaseInfo info) override
 
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi) override
 
virtual size_t write (const uint8_t *buffer, size_t size) override=0
 
virtual size_t write (uint8_t ch) override
 
- Public Member Functions inherited from Print
virtual int availableForWrite ()
 
void clearWriteError ()
 
virtual void flush ()
 
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)
 
virtual size_t write (const uint8_t *buffer, size_t size)
 
virtual size_t write (uint8_t)=0
 
- Public Member Functions inherited from audio_tools::AudioBaseInfoDependent
virtual AudioBaseInfo audioInfo ()=0
 
virtual void setAudioInfo (AudioBaseInfo info)=0
 
virtual bool validate (AudioBaseInfo &info)
 
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi)=0
 

Protected Attributes

bool active
 
AudioDecoderdecoder_ptr = CodecNOP::instance()
 
AudioEncoderencoder_ptr = CodecNOP::instance()
 
Printptr_out = nullptr
 
uint8_t * write_buffer = nullptr
 
int write_buffer_pos = 0
 
const int write_buffer_size = 256
 
AudioWriterwriter_ptr = nullptr
 
- Protected Attributes inherited from audio_tools::AudioPrint
AudioBaseInfo cfg
 
AudioBaseInfoDependentp_notify =nullptr
 
uint8_t tmp [MAX_SINGLE_CHARS]
 
int tmpPos =0
 

Additional Inherited Members

- Protected Member Functions inherited from Print
void setWriteError (int err=1)
 

Detailed Description

A more natural Stream class to process encoded data (aac, wav, mp3...).

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ EncodedAudioStream() [1/5]

audio_tools::EncodedAudioStream::EncodedAudioStream ( Print outputStream,
AudioDecoder decoder 
)
inline

Construct a new Encoded Stream object - used for decoding.

Parameters
outputStream
decoder

◆ EncodedAudioStream() [2/5]

audio_tools::EncodedAudioStream::EncodedAudioStream ( Print outputStream,
AudioDecoder decoder 
)
inline

Construct a new Encoded Audio Stream object - used for decoding.

Parameters
outputStream
decoder

◆ EncodedAudioStream() [3/5]

audio_tools::EncodedAudioStream::EncodedAudioStream ( Print outputStream,
AudioEncoder encoder 
)
inline

Construct a new Encoded Audio Stream object - used for encoding.

Parameters
outputStream
encoder

◆ EncodedAudioStream() [4/5]

audio_tools::EncodedAudioStream::EncodedAudioStream ( Print outputStream,
AudioEncoder encoder 
)
inline

Construct a new Encoded Audio Stream object - used for encoding.

Parameters
outputStream
encoder

◆ EncodedAudioStream() [5/5]

audio_tools::EncodedAudioStream::EncodedAudioStream ( )
inline

Construct a new Encoded Audio Stream object - the Output and Encoder/Decoder needs to be defined with the begin method.

◆ ~EncodedAudioStream()

virtual audio_tools::EncodedAudioStream::~EncodedAudioStream ( )
inlinevirtual

Destroy the Encoded Audio Stream object.

Member Function Documentation

◆ availableForWrite()

int audio_tools::EncodedAudioStream::availableForWrite ( )
inlineoverridevirtual

Reimplemented from audio_tools::AudioPrint.

◆ setAudioInfo()

virtual void audio_tools::EncodedAudioStream::setAudioInfo ( AudioBaseInfo  info)
inlineoverridevirtual

Reimplemented from audio_tools::AudioPrint.

◆ setNotifyAudioChange()

void audio_tools::EncodedAudioStream::setNotifyAudioChange ( AudioBaseInfoDependent bi)
inlineoverridevirtual

Define object which need to be notified if the basinfo is changing.

Reimplemented from audio_tools::AudioPrint.

◆ write()

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

encode the data

Implements audio_tools::AudioPrint.


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