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

Inheritance diagram for EncodedAudioOutput:
ModifyingOutput AudioOutput Print AudioInfoSupport AudioInfoSource

Public Member Functions

 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)
 
void addNotifyAudioChange (AudioInfoSupport &bi) override
 Define object which need to be notified if the basinfo is changing.
 
virtual AudioInfo audioInfo () override
 provides the actual input AudioInfo
 
virtual AudioInfo audioInfoOut ()
 provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
 
int availableForWrite () override
 
bool begin () override
 Starts the processing - sets the status to active.
 
virtual bool begin (AudioInfo newInfo)
 Starts the processing - sets the status to active.
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
AudioDecoderdecoder ()
 Provides the initialized decoder.
 
AudioInfo defaultConfig ()
 
AudioEncoderencoder ()
 Provides the initialized encoder.
 
void end () override
 Ends the processing.
 
virtual void flush ()
 
AudioDecodergetDecoder ()
 
AudioEncodergetEncoder ()
 
bool isCheckAvailableForWrite ()
 Is Available for Write check activated ?
 
virtual bool isDeletable ()
 If true we need to release the related memory in the destructor.
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
 operator bool ()
 Returns true if status is active and we still have data to be processed.
 
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 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 setOutput (Print &outputStream)
 Defines/Changes the output target.
 
void setOutput (Print *outputStream)
 Defines the output.
 
virtual size_t write (const uint8_t *data, size_t len) override
 encoder decode the data
 
virtual size_t write (uint8_t ch) override
 
virtual void writeSilence (size_t len)
 

Protected Member Functions

void notifyAudioChange (AudioInfo info)
 

Protected Attributes

int _timeout = 10
 
bool active = false
 
AudioInfo cfg
 
bool check_available_for_write = false
 
AudioDecoderdecoder_ptr = CodecNOP::instance()
 
AudioEncoderencoder_ptr = CodecNOP::instance()
 
int frame_size = DEFAULT_BUFFER_SIZE
 
bool is_active = false
 
bool is_notify_active = true
 
Vector< AudioInfoSupport * > notify_vector
 
Printptr_out = nullptr
 
SingleBuffer< uint8_t > tmp {MAX_SINGLE_CHARS}
 
int tmpPos = 0
 
AudioWriterwriter_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

Member Function Documentation

◆ writeSilence()

virtual void writeSilence ( size_t  len)
inlinevirtualinherited

Writes n 0 values (= silence)

Parameters
len

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