arduino-audio-tools
Loading...
Searching...
No Matches
EncodedAudioOutput Class Reference

A more natural Print class to process encoded data (aac, wav, mp3...). Just define the output and the decoder and write the encoded data. More...

#include <CodecTSDemux.h>

Inheritance diagram for EncodedAudioOutput:
ModifyingOutput AudioOutput AudioOutput AudioInfoSource AudioInfoSupport Print AudioInfoSource AudioInfoSupport Print AudioInfoSource AudioInfoSupport Print AudioInfoSource AudioInfoSupport Print

Public Member Functions

 EncodedAudioOutput ()
 EncodedAudioOutput (AudioDecoder *decoder)
 EncodedAudioOutput (AudioEncoder *encoder)
 EncodedAudioOutput (AudioOutput *outputStream, AudioDecoder *decoder)
 EncodedAudioOutput (AudioOutput *outputStream, AudioEncoder *encoder)
 EncodedAudioOutput (AudioStream *outputStream, AudioDecoder *decoder)
 EncodedAudioOutput (AudioStream *outputStream, AudioEncoder *encoder)
 EncodedAudioOutput (Print *outputStream, AudioDecoder *decoder)
 EncodedAudioOutput (Print *outputStream, AudioEncoder *encoder)
virtual ~EncodedAudioOutput ()
void addNotifyAudioChange (AudioInfoSupport &bi) override
 Define object which need to be notified if the basinfo is changing.
AudioInfo audioInfo () override
 Provide audio info from decoder if relevant.
virtual AudioInfo audioInfoOut ()
virtual AudioInfo audioInfoOut ()
int availableForWrite () override
bool begin () override
 Starts the processing - sets the status to active.
virtual bool begin (AudioInfo newInfo) override
 Starts the processing - sets the status to active.
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
AudioDecoder & decoder ()
 Provides the initialized decoder.
AudioInfo defaultConfig ()
AudioEncoder & encoder ()
 Provides the initialized encoder.
void end () override
 Ends the processing.
virtual void flush ()
virtual void flush ()
AudioDecoder * getDecoder ()
AudioEncoder * getEncoder ()
bool isCheckAvailableForWrite ()
 Is Available for Write check activated ?
bool isDecoder ()
virtual bool isDeletable ()
 If true we need to release the related memory in the destructor.
virtual bool isDeletable ()
 If true we need to release the related memory in the destructor.
bool isEncoder ()
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 operator bool () override
 Returns true if status is active and we still have data to be processed.
EncodedAudioOutput & operator= (EncodedAudioOutput const &src)
virtual bool removeNotifyAudioChange (AudioInfoSupport &bi)
 Removes a target in order not to be notified about audio changes.
virtual bool removeNotifyAudioChange (AudioInfoSupport &bi)
 Removes a target in order not to be notified about audio changes.
virtual void setAudioInfo (AudioInfo newInfo) override
 Defines the input AudioInfo.
void setCheckAvailableForWrite (bool check)
 Activate/Deactivate the Available for Write check: if activated, the write.
void setDecoder (AudioDecoder *decoder)
void setEncoder (AudioEncoder *encoder)
void setFrameSize (int size)
 defines the size of the decoded frame in bytes
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active).
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active).
void setOutput (AudioOutput &outputStream)
void setOutput (AudioOutput *out)
void setOutput (AudioStream &outputStream)
void setOutput (AudioStream *out)
void setOutput (Print &outputStream) override
 Defines/Changes the output target.
void setOutput (Print *outputStream)
 Defines the output.
virtual size_t write (uint8_t ch) override
virtual size_t write (const uint8_t *data, size_t len) override
 encoder decode the data
virtual void writeSilence (size_t len)
virtual void writeSilence (size_t len)

Protected Member Functions

void notifyAudioChange (AudioInfo info)
void notifyAudioChange (AudioInfo info)

Protected Attributes

int _timeout = 10
bool active = false
AudioInfo cfg
bool check_available_for_write = false
AudioDecoder * decoder_ptr = undefined
AudioEncoder * encoder_ptr = undefined
int frame_size = 125
bool is_active = false
bool is_notify_active = true
Vector< AudioInfoSupport * > notify_vector
Print * ptr_out = nullptr
SingleBuffer< uint8_t > tmp { 8 }
int tmpPos = 0
AudioInfoSupport * to_notify = nullptr
CodecNOP * undefined = CodecNOP::instance()
AudioWriter * writer_ptr = nullptr

Detailed Description

A more natural Print class to process encoded data (aac, wav, mp3...). Just define the output and the decoder and write the encoded data.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ EncodedAudioOutput() [1/9]

EncodedAudioOutput ( )
inline

◆ EncodedAudioOutput() [2/9]

EncodedAudioOutput ( AudioDecoder * decoder)
inline

◆ EncodedAudioOutput() [3/9]

EncodedAudioOutput ( AudioEncoder * encoder)
inline

◆ EncodedAudioOutput() [4/9]

EncodedAudioOutput ( AudioStream * outputStream,
AudioDecoder * decoder )
inline

◆ EncodedAudioOutput() [5/9]

EncodedAudioOutput ( AudioOutput * outputStream,
AudioDecoder * decoder )
inline

◆ EncodedAudioOutput() [6/9]

EncodedAudioOutput ( Print * outputStream,
AudioDecoder * decoder )
inline

◆ EncodedAudioOutput() [7/9]

EncodedAudioOutput ( Print * outputStream,
AudioEncoder * encoder )
inline

◆ EncodedAudioOutput() [8/9]

EncodedAudioOutput ( AudioOutput * outputStream,
AudioEncoder * encoder )
inline

◆ EncodedAudioOutput() [9/9]

EncodedAudioOutput ( AudioStream * outputStream,
AudioEncoder * encoder )
inline

◆ ~EncodedAudioOutput()

virtual ~EncodedAudioOutput ( )
inlinevirtual

Member Function Documentation

◆ addNotifyAudioChange()

void addNotifyAudioChange ( AudioInfoSupport & bi)
inlineoverridevirtual

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

Reimplemented from AudioInfoSource.

◆ audioInfo()

AudioInfo audioInfo ( )
inlineoverridevirtual

Provide audio info from decoder if relevant.

Reimplemented from AudioOutput.

◆ audioInfoOut() [1/2]

◆ audioInfoOut() [2/2]

◆ availableForWrite()

int availableForWrite ( )
inlineoverridevirtual

Reimplemented from AudioOutput.

◆ begin() [1/2]

bool begin ( )
inlineoverridevirtual

Starts the processing - sets the status to active.

Reimplemented from AudioOutput.

◆ begin() [2/2]

virtual bool begin ( AudioInfo newInfo)
inlineoverridevirtual

Starts the processing - sets the status to active.

Reimplemented from AudioOutput.

◆ clearNotifyAudioChange() [1/2]

virtual void clearNotifyAudioChange ( )
inlinevirtualinherited

◆ clearNotifyAudioChange() [2/2]

virtual void clearNotifyAudioChange ( )
inlinevirtualinherited

◆ decoder()

AudioDecoder & decoder ( )
inline

Provides the initialized decoder.

◆ defaultConfig()

AudioInfo defaultConfig ( )
inline

◆ encoder()

AudioEncoder & encoder ( )
inline

Provides the initialized encoder.

◆ end()

void end ( )
inlineoverridevirtual

Ends the processing.

Reimplemented from AudioOutput.

◆ flush() [1/2]

virtual void flush ( )
inlinevirtualinherited

Reimplemented from Print.

Reimplemented in HexDumpOutput, HexDumpOutput, MultiOutput, HexDumpOutput, and MultiOutput.

◆ flush() [2/2]

virtual void flush ( )
inlinevirtualinherited

Reimplemented from Print.

Reimplemented in HexDumpOutput, HexDumpOutput, MultiOutput, HexDumpOutput, and MultiOutput.

◆ getDecoder()

AudioDecoder * getDecoder ( )
inline

◆ getEncoder()

AudioEncoder * getEncoder ( )
inline

◆ isCheckAvailableForWrite()

bool isCheckAvailableForWrite ( )
inline

Is Available for Write check activated ?

◆ isDecoder()

bool isDecoder ( )
inline

◆ isDeletable() [1/2]

virtual bool isDeletable ( )
inlinevirtualinherited

If true we need to release the related memory in the destructor.

Reimplemented in AdapterAudioStreamToAudioOutput, AdapterPrintToAudioOutput, AdapterAudioStreamToAudioOutput, and AdapterPrintToAudioOutput.

◆ isDeletable() [2/2]

virtual bool isDeletable ( )
inlinevirtualinherited

If true we need to release the related memory in the destructor.

Reimplemented in AdapterAudioStreamToAudioOutput, AdapterPrintToAudioOutput, AdapterAudioStreamToAudioOutput, and AdapterPrintToAudioOutput.

◆ isEncoder()

bool isEncoder ( )
inline

◆ isNotifyActive() [1/2]

bool isNotifyActive ( )
inlineinherited

Checks if the automatic AudioInfo update is active.

◆ isNotifyActive() [2/2]

bool isNotifyActive ( )
inlineinherited

Checks if the automatic AudioInfo update is active.

◆ notifyAudioChange() [1/2]

void notifyAudioChange ( AudioInfo info)
inlineprotectedinherited

◆ notifyAudioChange() [2/2]

void notifyAudioChange ( AudioInfo info)
inlineprotectedinherited

◆ operator bool()

operator bool ( )
inlineoverridevirtual

Returns true if status is active and we still have data to be processed.

Reimplemented from AudioOutput.

◆ operator=()

EncodedAudioOutput & operator= ( EncodedAudioOutput const & src)
inline

◆ removeNotifyAudioChange() [1/2]

virtual bool removeNotifyAudioChange ( AudioInfoSupport & bi)
inlinevirtualinherited

Removes a target in order not to be notified about audio changes.

◆ removeNotifyAudioChange() [2/2]

virtual bool removeNotifyAudioChange ( AudioInfoSupport & bi)
inlinevirtualinherited

Removes a target in order not to be notified about audio changes.

◆ setAudioInfo()

virtual void setAudioInfo ( AudioInfo info)
inlineoverridevirtual

Defines the input AudioInfo.

Reimplemented from AudioOutput.

◆ setCheckAvailableForWrite()

void setCheckAvailableForWrite ( bool check)
inline

Activate/Deactivate the Available for Write check: if activated, the write.

◆ setDecoder()

void setDecoder ( AudioDecoder * decoder)
inline

◆ setEncoder()

void setEncoder ( AudioEncoder * encoder)
inline

◆ setFrameSize()

void setFrameSize ( int size)
inline

defines the size of the decoded frame in bytes

◆ setNotifyActive() [1/2]

void setNotifyActive ( bool flag)
inlineinherited

Deactivate/Reactivate automatic AudioInfo updates: (default is active).

◆ setNotifyActive() [2/2]

void setNotifyActive ( bool flag)
inlineinherited

Deactivate/Reactivate automatic AudioInfo updates: (default is active).

◆ setOutput() [1/6]

void setOutput ( AudioOutput & outputStream)
inline

◆ setOutput() [2/6]

void setOutput ( AudioOutput * out)
inline

◆ setOutput() [3/6]

void setOutput ( AudioStream & outputStream)
inline

◆ setOutput() [4/6]

void setOutput ( AudioStream * out)
inline

◆ setOutput() [5/6]

void setOutput ( Print & out)
inlineoverridevirtual

Defines/Changes the output target.

Implements ModifyingOutput.

◆ setOutput() [6/6]

void setOutput ( Print * outputStream)
inline

Defines the output.

◆ write() [1/2]

virtual size_t write ( uint8_t ch)
inlineoverridevirtualinherited

Reimplemented in MultiOutput, MetaDataOutput, and MultiOutput.

◆ write() [2/2]

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

encoder decode the data

Implements AudioOutput.

◆ writeSilence() [1/2]

virtual void writeSilence ( size_t len)
inlinevirtualinherited

Writes n 0 values (= silence)

Parameters
len

◆ writeSilence() [2/2]

virtual void writeSilence ( size_t len)
inlinevirtualinherited

Writes n 0 values (= silence)

Parameters
len

Member Data Documentation

◆ _timeout

int _timeout = 10
protectedinherited

◆ active

bool active = false
protected

◆ cfg

AudioInfo cfg
protectedinherited

◆ check_available_for_write

bool check_available_for_write = false
protected

◆ decoder_ptr

AudioDecoder* decoder_ptr = undefined
protected

◆ encoder_ptr

AudioEncoder* encoder_ptr = undefined
protected

◆ frame_size

int frame_size = 125
protected

◆ is_active

bool is_active = false
protectedinherited

◆ is_notify_active

bool is_notify_active = true
protectedinherited

◆ notify_vector

Vector< AudioInfoSupport * > notify_vector
protectedinherited

◆ ptr_out

Print* ptr_out = nullptr
protected

◆ tmp

SingleBuffer< uint8_t > tmp { 8 }
protectedinherited

◆ tmpPos

int tmpPos = 0
protectedinherited

◆ to_notify

AudioInfoSupport* to_notify = nullptr
protected

◆ undefined

CodecNOP* undefined = CodecNOP::instance()
protected

◆ writer_ptr

AudioWriter* writer_ptr = nullptr
protected

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