arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
WAVHeader Class Reference

Parser for Wav header data for details see https://de.wikipedia.org/wiki/RIFF_WAVE. More...

#include <CodecWAV.h>

Public Member Functions

 WAVHeader ()=default
 
WAVAudioInfoaudioInfo ()
 provides the info from the header
 
size_t available ()
 number of bytes available in the header buffer
 
void clear ()
 Reset internal stored header information and buffer.
 
void dumpHeader ()
 Debug helper: dumps header bytes as printable characters.
 
int getDataPos ()
 Determines the data start position using the data tag.
 
bool isDataComplete ()
 Returns true if the header is complete (containd data tag)
 
bool parse ()
 Call when header data write is complete to parse the data.
 
void setAudioInfo (WAVAudioInfo info)
 Sets the info in the header.
 
int write (uint8_t *data, size_t data_len)
 
bool writeHeader (Print *out)
 Just write a wav header to the indicated outputbu.
 
bool writeHeader (Print *out, const WAVAudioInfo &info)
 Just write a wav header with explicit info to the indicated output.
 

Protected Member Functions

bool eof ()
 
int getChar ()
 
uint32_t getChar32 ()
 
int indexOf (const char *str)
 
void logInfo ()
 
uint16_t read_int16 ()
 
uint32_t read_int32 ()
 
uint32_t read_tag ()
 
void seek (long int offset, int origin)
 
bool setPos (const char *id)
 
void skip (int n)
 
size_t tell ()
 
void write16 (BaseBuffer< uint8_t > &buffer, uint16_t value)
 
void write32 (BaseBuffer< uint8_t > &buffer, uint64_t value)
 
void writeDataHeader (BaseBuffer< uint8_t > &buffer, const WAVAudioInfo &info)
 
void writeFMT (BaseBuffer< uint8_t > &buffer, const WAVAudioInfo &info)
 
void writeRiffHeader (BaseBuffer< uint8_t > &buffer, const WAVAudioInfo &info)
 

Protected Attributes

SingleBuffer< uint8_tbuffer { 200 }
 
size_t data_pos = 0
 
WAVAudioInfo headerInfo
 

Detailed Description

Parser for Wav header data for details see https://de.wikipedia.org/wiki/RIFF_WAVE.

Logic notes for WAVAudioInfo size fields:

Parsing behavior:

Writing behavior:

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ WAVHeader()

WAVHeader ( )
default

Member Function Documentation

◆ audioInfo()

WAVAudioInfo & audioInfo ( )
inline

provides the info from the header

◆ available()

size_t available ( )
inline

number of bytes available in the header buffer

◆ clear()

void clear ( )
inline

Reset internal stored header information and buffer.

◆ dumpHeader()

void dumpHeader ( )
inline

Debug helper: dumps header bytes as printable characters.

◆ eof()

bool eof ( )
inlineprotected

◆ getChar()

int getChar ( )
inlineprotected

◆ getChar32()

uint32_t getChar32 ( )
inlineprotected

◆ getDataPos()

int getDataPos ( )
inline

Determines the data start position using the data tag.

◆ indexOf()

int indexOf ( const char str)
inlineprotected

◆ isDataComplete()

bool isDataComplete ( )
inline

Returns true if the header is complete (containd data tag)

◆ logInfo()

void logInfo ( )
inlineprotected

◆ parse()

bool parse ( )
inline

Call when header data write is complete to parse the data.

◆ read_int16()

uint16_t read_int16 ( )
inlineprotected

◆ read_int32()

uint32_t read_int32 ( )
inlineprotected

◆ read_tag()

uint32_t read_tag ( )
inlineprotected

◆ seek()

void seek ( long int  offset,
int  origin 
)
inlineprotected

◆ setAudioInfo()

void setAudioInfo ( WAVAudioInfo  info)
inline

Sets the info in the header.

◆ setPos()

bool setPos ( const char id)
inlineprotected

◆ skip()

void skip ( int  n)
inlineprotected

◆ tell()

size_t tell ( )
inlineprotected

◆ write()

int write ( uint8_t data,
size_t  data_len 
)
inline

Adds data to the 44 byte wav header data buffer and make it available for parsing

◆ write16()

void write16 ( BaseBuffer< uint8_t > &  buffer,
uint16_t  value 
)
inlineprotected

◆ write32()

void write32 ( BaseBuffer< uint8_t > &  buffer,
uint64_t  value 
)
inlineprotected

◆ writeDataHeader()

void writeDataHeader ( BaseBuffer< uint8_t > &  buffer,
const WAVAudioInfo info 
)
inlineprotected

◆ writeFMT()

void writeFMT ( BaseBuffer< uint8_t > &  buffer,
const WAVAudioInfo info 
)
inlineprotected

◆ writeHeader() [1/2]

bool writeHeader ( Print out)
inline

Just write a wav header to the indicated outputbu.

◆ writeHeader() [2/2]

bool writeHeader ( Print out,
const WAVAudioInfo info 
)
inline

Just write a wav header with explicit info to the indicated output.

◆ writeRiffHeader()

void writeRiffHeader ( BaseBuffer< uint8_t > &  buffer,
const WAVAudioInfo info 
)
inlineprotected

Member Data Documentation

◆ buffer

SingleBuffer<uint8_t> buffer { 200 }
protected

◆ data_pos

size_t data_pos = 0
protected

◆ headerInfo

WAVAudioInfo headerInfo
protected

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