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:
AudioStream Stream AudioInfoSupport AudioInfoSource Print EncodedAudioStream

Public Member Functions

 EncodedAudioOutput (AudioDecoder *decoder)
 
 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
 
virtual int available () override
 
int availableForWrite () override
 
bool begin () override
 Starts the processing - sets the status to active.
 
virtual bool begin (AudioInfo cfg)
 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 () override
 
AudioDecodergetDecoder ()
 
AudioEncodergetEncoder ()
 
bool isCheckAvailableForWrite ()
 Is Available for Write check activated ?
 
 operator bool ()
 Returns true if status is active and we still have data to be processed.
 
virtual size_t readBytes (uint8_t *buffer, size_t length)
 
virtual size_t readSilence (uint8_t *buffer, size_t length)
 Source to generate silence: just sets the buffer to 0.
 
virtual bool removeNotifyAudioChange (AudioInfoSupport &bi)
 Removes a target in order not to be notified about audio changes.
 
virtual void setAudioInfo (AudioInfo info) override
 
void setDecoder (AudioDecoder *decoder)
 
void setEncoder (AudioEncoder *encoder)
 
void setFrameSize (int size)
 defines the size of the decoded frame in bytes
 
void setLogLevel (AudioLogger::LogLevel level)
 Defines the class specific custom log level.
 
virtual void setNotifyAudioChange (AudioInfoSupport &bi)
 Obsolete: Use addNotifyAudioChange.
 
void setOutput (Print *outputStream)
 Defines the output.
 
void setStream (Print *outputStream)
 The same as setOutput.
 
virtual size_t write (const uint8_t *data, size_t len) override
 encodeor decode the data
 
virtual size_t write (uint8_t ch) override
 
virtual void writeSilence (size_t len)
 Writes len bytes of silence (=0).
 

Protected Member Functions

bool contains (AudioInfoSupport &bi)
 
virtual int not_supported (int out, const char *msg="")
 
void notifyAudioChange (AudioInfo info)
 
void refillReadBuffer ()
 

Protected Attributes

int _timeout = 10
 
bool active = false
 
bool check_available_for_write = false
 
CustomLogLevel custom_log_level
 
AudioDecoderdecoder_ptr = CodecNOP::instance()
 
AudioEncoderencoder_ptr = CodecNOP::instance()
 
int frame_size = DEFAULT_BUFFER_SIZE
 
AudioInfo info
 
Vector< AudioInfoSupport * > notify_vector
 
Printptr_out = nullptr
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_out {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

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