arduino-audio-tools
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
WAVDecoder Class Reference

A simple WAVDecoder: We parse the header data on the first record to determine the format. If no AudioDecoderExt is specified we just write the PCM data to the output that is defined by calling setOutput(). You can define a ADPCM decoder to decode WAV files that contain ADPCM data. Please note that you need to call begin() everytime you process a new file to let the decoder know that we start with a new header. More...

#include <CodecWAV.h>

Inheritance diagram for WAVDecoder:
AudioDecoder AudioWriter AudioInfoSource AudioInfoSupport

Public Member Functions

 WAVDecoder ()=default
 Construct a new WAVDecoder object for PCM data.
 
 WAVDecoder (AudioDecoderExt &dec, AudioFormat fmt)
 Construct a new WAVDecoder object for ADPCM data.
 
virtual void addNotifyAudioChange (AudioInfoSupport &bi)
 Adds target to be notified about audio changes.
 
AudioInfo audioInfo () override
 provides the actual input AudioInfo
 
WAVAudioInfoaudioInfoEx ()
 
virtual AudioInfo audioInfoOut ()
 provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
 
bool begin () override
 
virtual bool begin (AudioInfo info) override
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
void end () override
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
virtual bool isResultPCM ()
 Returns true to indicate that the decoding result is PCM data.
 
const char * mime ()
 
virtual operator bool () override
 
virtual bool removeNotifyAudioChange (AudioInfoSupport &bi)
 Removes a target in order not to be notified about audio changes.
 
virtual void setAudioInfo (AudioInfo from) override
 for most decoders this is not needed
 
void setDecoder (AudioDecoderExt &dec, AudioFormat fmt)
 Defines an optional decoder if the format is not PCM.
 
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
virtual void setOutput (AudioOutput &out_stream)
 Defines where the decoded result is written to.
 
virtual void setOutput (AudioStream &out_stream)
 Defines where the decoded result is written to.
 
void setOutput (Print &out_stream) override
 Defines the output Stream.
 
virtual size_t write (const uint8_t *data, size_t len) override
 

Public Attributes

int id
 custom id to be used by application
 

Protected Member Functions

int decodeHeader (uint8_t *in_ptr, size_t in_size)
 Decodes the header data: Returns the start pos of the data.
 
int32_t interpret24bitAsInt32 (uint8_t *byteArray)
 
void notifyAudioChange (AudioInfo info)
 
Printout ()
 
void setupEncodedAudio ()
 
virtual size_t write_out (const uint8_t *in_ptr, size_t in_size)
 
size_t write_out_24 (const uint8_t *in_ptr, size_t in_size)
 
void writeBlocking (Print *out, uint8_t *data, size_t len)
 

Protected Attributes

bool active = false
 
SingleBuffer< uint8_t > buffer24
 
EncodedAudioOutput dec_out
 
AudioFormat decoder_format = AudioFormat::PCM
 
WAVHeader header
 
AudioInfo info
 
bool is_notify_active = true
 
bool isFirst = true
 
bool isValid = true
 
Vector< AudioInfoSupport * > notify_vector
 
AudioDecoderExtp_decoder = nullptr
 
Printp_print = nullptr
 

Detailed Description

A simple WAVDecoder: We parse the header data on the first record to determine the format. If no AudioDecoderExt is specified we just write the PCM data to the output that is defined by calling setOutput(). You can define a ADPCM decoder to decode WAV files that contain ADPCM data. Please note that you need to call begin() everytime you process a new file to let the decoder know that we start with a new header.

Author
Phil Schatzmann

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