|
arduino-audio-tools
|
Parser for Wav header data for details see https://de.wikipedia.org/wiki/RIFF_WAVE. More...
#include <CodecWAV.h>
Public Member Functions | |
| WAVHeader ()=default | |
| WAVAudioInfo & | audioInfo () |
| 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_t > | buffer { 200 } |
| size_t | data_pos = 0 |
| WAVAudioInfo | headerInfo |
Parser for Wav header data for details see https://de.wikipedia.org/wiki/RIFF_WAVE.
Logic notes for WAVAudioInfo size fields:
file_size stores the full RIFF file size in bytes. In the RIFF header this is written/read as chunk_size = file_size - 8.data_length stores the WAV payload size (data chunk length).is_streamed indicates unknown/unbounded payload length.Parsing behavior:
chunk_size is normalized to full file_size by adding 8.data_length is 0 or very large (>= 0x7fff0000), the stream is treated as streamed (is_streamed=true) and data_length is normalized to ~0.Writing behavior:
file_size - 8 into the chunk-size field.data_length==0 in non-streamed mode, it is derived from file_size - 36 (standard WAV relationship).data_length is written as max (~0) when not set.
|
default |
|
inline |
provides the info from the header
|
inline |
number of bytes available in the header buffer
|
inline |
Reset internal stored header information and buffer.
|
inline |
Debug helper: dumps header bytes as printable characters.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inline |
Determines the data start position using the data tag.
|
inline |
Returns true if the header is complete (containd data tag)
|
inlineprotected |
|
inline |
Call when header data write is complete to parse the data.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inline |
Sets the info in the header.
|
inlineprotected |
Adds data to the 44 byte wav header data buffer and make it available for parsing
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inline |
Just write a wav header with explicit info to the indicated output.
|
inlineprotected |
|
protected |
|
protected |
|
protected |