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

A simple WAV file encoder. If no AudioEncoderExt is specified the WAV file contains PCM data, otherwise it is encoded as ADPCM. The WAV header is written with the first writing of audio data. Calling begin() is making sure that the header is written again. More...

#include <CodecWAV.h>

Inheritance diagram for WAVEncoder:
AudioEncoder AudioWriter AudioInfoSupport

Public Member Functions

 WAVEncoder ()=default
 Construct a new WAVEncoder object for PCM data.
 
 WAVEncoder (AudioEncoderExt &enc, AudioFormat fmt)
 Construct a new WAVEncoder object for ADPCM data.
 
virtual AudioInfo audioInfoOut ()
 provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
 
virtual bool begin () override
 starts the processing using the actual WAVAudioInfo
 
virtual bool begin (AudioInfo info)
 
bool begin (WAVAudioInfo ai)
 starts the processing
 
WAVAudioInfo defaultConfig ()
 
void end () override
 stops the processing
 
bool isOpen ()
 
const char * mime () override
 Provides "audio/wav".
 
 operator bool () override
 
virtual void setAudioInfo (AudioInfo from) override
 Update actual WAVAudioInfo.
 
virtual void setAudioInfo (WAVAudioInfo ai)
 Defines the WAVAudioInfo.
 
void setDataOffset (uint16_t offset)
 Adds n empty bytes at the beginning of the data.
 
void setEncoder (AudioEncoderExt &enc, AudioFormat fmt)
 
void setOutput (Print &out) override
 Defines the otuput stream.
 
virtual size_t write (const uint8_t *data, size_t len) override
 Writes PCM data to be encoded as WAV.
 

Protected Member Functions

void setupEncodedAudio ()
 
void writeBlocking (Print *out, uint8_t *data, size_t len)
 

Protected Attributes

WAVAudioInfo audioInfo = defaultConfig()
 
EncodedAudioOutput enc_out
 
WAVHeader header
 
bool header_written = false
 
AudioInfo info
 
volatile bool is_open = false
 
AudioEncoderExtp_encoder = nullptr
 
Printp_print = nullptr
 
int64_t size_limit = 0
 

Detailed Description

A simple WAV file encoder. If no AudioEncoderExt is specified the WAV file contains PCM data, otherwise it is encoded as ADPCM. The WAV header is written with the first writing of audio data. Calling begin() is making sure that the header is written again.

Author
Phil Schatzmann

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