Expand description
WAV audio container support. WAV reader and writer with KotOR obfuscation handling.
KotOR uses multiple wrappers around audio payloads:
- standard RIFF/WAVE files,
- SFX files with a 470-byte prefix header,
- MP3-in-WAV wrappers (58-byte prefix followed by raw MP3 data).
This module implements container-level parsing/serialization only. It does not decode PCM/ADPCM sample streams.
§Format Layout
Standard WAVE:
+------------------------------+ 0x0000
| "RIFF" + size + "WAVE" |
+------------------------------+
| Chunks ("fmt ", "data", ...) |
+------------------------------+
KotOR SFX wrapper:
+------------------------------+ 0x0000
| 470-byte SFX header |
| starts with FF F3 60 C4 |
+------------------------------+ 0x01DA
| Standard RIFF/WAVE payload |
+------------------------------+
MP3-in-WAV wrapper:
+------------------------------+ 0x0000
| 58-byte wrapper |
| starts with "RIFF", size=50 |
+------------------------------+ 0x003A
| Raw MP3 payload |
+------------------------------+Modules§
Structs§
- Wav
- In-memory WAV payload.
- WavEncoding
Code - Lossless WAVE encoding tag wrapper.
- WavWave
Metadata - Metadata fields for WAVE-format payloads.
- WavWrite
Options - WAV writer options.
Enums§
- WavAudio
Format - Audio payload format represented by
Wav. - WavEncoding
- Known WAVE encoding tags.
- WavError
- WAV parse/write errors.
- WavType
- KotOR-facing wrapper type used when writing.
- WavWrapper
Kind - WAV wrapper variant detected in source bytes.
- WavWrite
Mode - WAV write target mode.
Functions§
- read_
wav - Reads WAV data from a reader.
- read_
wav_ from_ bytes - Reads WAV data from bytes.
- write_
wav - Writes WAV data to a writer using
WavWriteMode::Game. - write_
wav_ to_ vec - Serializes WAV data to a byte vector using
WavWriteMode::Game. - write_
wav_ to_ vec_ with_ options - Serializes WAV data to a byte vector with explicit options.
- write_
wav_ with_ options - Writes WAV data to a writer with explicit options.