Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
EncodedAudioStream Class Reference

A more natural Stream class to process encoded data (aac, wav, mp3...) which also supports the decoding by calling readBytes(). More...

#include <AudioEncoded.h>

Inheritance diagram for EncodedAudioStream:
EncodedAudioOutput AudioStream Stream AudioInfoSupport AudioInfoSource Print

Public Member Functions

 EncodedAudioStream (AudioDecoder *decoder)
 EncodedAudioStream (AudioOutput *outputStream, AudioDecoder *decoder)
 EncodedAudioStream (AudioStream *ioStream, AudioDecoder *decoder)
 EncodedAudioStream (Print *outputStream, AudioDecoder *decoder)
 EncodedAudioStream (Print *outputStream, AudioEncoder *encoder)
 EncodedAudioStream (Stream *ioStream, AudioDecoder *decoder)
virtual AudioInfo audioInfo () override
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.
AudioDecoderdecoder ()
 Provides the initialized decoder.
AudioInfo defaultConfig ()
AudioEncoderencoder ()
 Provides the initialized encoder.
void end () override
 Ends the processing.
virtual void flush () override
 operator bool ()
 Returns true if status is active and we still have data to be processed.
size_t readBytes (uint8_t *buffer, size_t length) override
virtual size_t readSilence (uint8_t *buffer, size_t length)
 Source to generate silence: just sets the buffer to 0.
void resize ()
 setup default size for buffer
void resize (int size)
 Defines the buffer size.
virtual void setAudioInfo (AudioInfo info) override
void setDecoder (AudioDecoder *decoder)
void setEncoder (AudioEncoder *encoder)
void setInput (Stream *ioStream)
 Same as setStream()
void setLogLevel (AudioLogger::LogLevel level)
 Defines the class specific custom log level.
void setNotifyAudioChange (AudioInfoSupport &bi) override
 Define object which need to be notified if the basinfo is changing.
void setOutput (Print *outputStream)
 Defines the output.
void setStream (Print *outputStream)
 The same as setOutput.
void setStream (Stream *ioStream)
 Defines the input/output stream for decoding.
virtual bool validate (AudioInfo &info)
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

void decode (int requestedBytes)
virtual int not_supported (int out, const char *msg="")
void refillReadBuffer ()
void setupOnce ()

Protected Attributes

bool active
Vector< uint8_t > copy_buffer {DEFAULT_BUFFER_SIZE}
CustomLogLevel custom_log_level
RingBuffer< uint8_t > decoded_buffer {0}
AudioDecoderdecoder_ptr = CodecNOP::instance()
AudioEncoderencoder_ptr = CodecNOP::instance()
AudioInfo info
bool is_setup = false
int max_read_count = 5
AudioInfoSupportp_notify =nullptr
Streamp_stream = nullptr
AudioWriterp_write = nullptr
Printptr_out = nullptr
QueueStream< uint8_t > queue_stream {decoded_buffer}
int reqested_bytes = DEFAULT_BUFFER_SIZE
RingBuffer< uint8_t > tmp_in {0}
RingBuffer< uint8_t > tmp_out {0}
AudioWriterwriter_ptr = nullptr

Detailed Description

A more natural Stream class to process encoded data (aac, wav, mp3...) which also supports the decoding by calling readBytes().

Phil Schatzmann

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