arduino-audio-tools
|
A Streaming Decoder where we provide both the input and output as streams. More...
#include <StreamingDecoder.h>
Public Member Functions | |
virtual void | addNotifyAudioChange (AudioInfoSupport &bi) |
Adds target to be notified about audio changes. | |
virtual AudioInfo | audioInfo ()=0 |
Provides the audio information for the current stream. | |
virtual AudioInfo | audioInfoOut () |
virtual bool | begin ()=0 |
Starts the processing. | |
virtual void | clearNotifyAudioChange () |
Deletes all change notify subscriptions. | |
virtual bool | copy ()=0 |
Process a single read operation - to be called in the loop. | |
bool | copyAll () |
Process all available data. | |
virtual void | end ()=0 |
Releases the reserved memory. | |
bool | isNotifyActive () |
Checks if the automatic AudioInfo update is active. | |
virtual const char * | mime ()=0 |
Provides the MIME type of the audio format handled by this decoder. | |
virtual | operator bool ()=0 |
Checks if the class is active. | |
virtual bool | removeNotifyAudioChange (AudioInfoSupport &bi) |
Removes a target in order not to be notified about audio changes. | |
void | setInput (Stream &inStream) |
Stream Interface: Decode directly by taking data from the stream. | |
void | setNotifyActive (bool flag) |
Deactivate/Reactivate automatic AudioInfo updates: (default is active) | |
virtual void | setOutput (AudioOutput &out_stream) |
Defines the output streams and register to be notified. | |
virtual void | setOutput (AudioStream &out_stream) |
Defines the output streams and register to be notified. | |
virtual void | setOutput (Print &out_stream) |
Defines the output Stream. | |
Protected Member Functions | |
void | notifyAudioChange (AudioInfo info) |
virtual size_t | readBytes (uint8_t *data, size_t len)=0 |
Reads bytes from the input stream. | |
void | setAudioInfo (AudioInfo newInfo) override |
Defines the input AudioInfo. | |
Protected Attributes | |
AudioInfo | info |
bool | is_notify_active = true |
Vector< AudioInfoSupport * > | notify_vector |
Stream * | p_input = nullptr |
Input stream for encoded audio data. | |
Print * | p_print = nullptr |
Output stream for decoded PCM data. | |
A Streaming Decoder where we provide both the input and output as streams.
This is the base class for all streaming decoders that process audio data by reading from an input stream and writing decoded PCM data to an output stream. Unlike AudioDecoder which uses a write-based interface, StreamingDecoder uses a pull-based approach where you call copy() to process data.
|
inlinevirtualinherited |
Adds target to be notified about audio changes.
Reimplemented in CodecNOP, EncodedAudioOutput, EncodedAudioStream, AACDecoderFDK, DecoderBasic, MP3DecoderHelix, MP3DecoderMAD, OggContainerDecoder, Pipeline, and Pipeline::ModifyingStreamAdapter.
|
pure virtual |
Provides the audio information for the current stream.
Returns audio format information such as sample rate, channels, and bits per sample that was determined from the decoded audio stream.
Implements AudioInfoSupport.
Implemented in FLACDecoder, VorbisDecoder, StreamingDecoderAdapter, and MultiStreamingDecoder.
|
inlinevirtualinherited |
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in PureDataStream, PWMAudioOutput, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, ResampleStream, and ResampleStreamT< TInterpolator >.
|
pure virtual |
Starts the processing.
Initializes the decoder and prepares it for processing audio data. Must be called before any copy() operations.
Implemented in FLACDecoder, VorbisDecoder, StreamingDecoderAdapter, and MultiStreamingDecoder.
|
pure virtual |
Process a single read operation - to be called in the loop.
Reads a chunk of data from the input stream, decodes it, and writes the decoded PCM data to the output stream.
Implemented in FLACDecoder, VorbisDecoder, StreamingDecoderAdapter, and MultiStreamingDecoder.
|
inline |
Process all available data.
Convenience method that calls copy() repeatedly until all available data has been processed.
|
pure virtual |
Releases the reserved memory.
Cleans up any resources allocated by the decoder and stops processing.
Implemented in FLACDecoder, VorbisDecoder, StreamingDecoderAdapter, and MultiStreamingDecoder.
|
pure virtual |
Provides the MIME type of the audio format handled by this decoder.
Implemented in FLACDecoder, VorbisDecoder, StreamingDecoderAdapter, and MultiStreamingDecoder.
|
pure virtual |
Checks if the class is active.
Implemented in FLACDecoder, VorbisDecoder, StreamingDecoderAdapter, and MultiStreamingDecoder.
|
protectedpure virtual |
Reads bytes from the input stream.
Derived classes must implement this to read data from their input source.
data | Buffer to store the read data |
len | Maximum number of bytes to read |
Implemented in FLACDecoder, VorbisDecoder, StreamingDecoderAdapter, and MultiStreamingDecoder.
|
inlineoverrideprotectedvirtual |
Defines the input AudioInfo.
Implements AudioInfoSupport.
|
inline |
|
inlinevirtual |
Defines the output streams and register to be notified.
Sets the output stream and registers for audio info change notifications.
out_stream | The AudioOutput to write decoded audio data to |
Reimplemented in MultiStreamingDecoder.
|
inlinevirtual |
Defines the output streams and register to be notified.
Sets the output stream and registers for audio info change notifications.
out_stream | The AudioStream to write decoded audio data to |
Reimplemented in MultiStreamingDecoder.
|
inlinevirtual |
Defines the output Stream.
Sets where the decoded PCM audio data will be written to.
out_stream | The Print stream to write decoded audio data to |
Reimplemented in StreamingDecoderAdapter, and MultiStreamingDecoder.