Audio formats
What the engine decodes, where each decoder lives and what to know before touching it. A track is streamed: a worker decodes a couple of seconds ahead into a ring at the device rate.
Supported
| Format | Extensions | Decoder |
|---|---|---|
| MP3 | .mp3 | dr_mp3 |
| WAV | .wav | dr_wav |
| FLAC | .flac | dr_flac |
| AAC LC, HE-AAC v1 (SBR), HE-AAC v2 (SBR and PS) | .m4a .mp4 .aac | The OS decoder |
.aac is raw ADTS, .m4a and .mp4 are MPEG-4 audio. The eq file picker lists all three.
The AAC path
audio_aac.h is a small block decoder: aac_open, aac_read, aac_seek and aac_close, over an offset read callback. audio_track.cpp wraps it as the source_aac and source_adts kinds next to WAV, FLAC and MP3, so the reader remap and the polyphase resampler to the device rate run unchanged.
| File | How | |
|---|---|---|
| Windows | audio_aac.cpp | Media Foundation source reader over a COM stream that reads through the offset callback, so the file is never copied into memory. The origin name extension picks the MPEG-4 or the ADTS handler. Float output, and the channels and rate are what the decoder reports. Links mfplat mfreadwrite mfuuid shlwapi ole32. |
| macOS | audio_aac_mac.cpp | AudioToolbox AudioFileOpenWithCallbacks over the same callback, plus ExtAudioFile with a float client format at the file rate. The open passes no write callbacks, because a writable open makes the MP4 reader refuse the file. Checked on the mac with LC, HE v1, HE v2, MP4, ADTS and tagged files. |
The length is not in the header the decoder reports, so open does one counting pass, like it does for a pipe WAV. No codec code ships with the engine, so there is no license to carry.
Seeking
The OS seek lands on a packet and drops the SBR and PS state of HE-AAC, so on Windows a seek rewinds to the start and decodes up to the frame. The result is sample exact for LC, HE v1 and HE v2, checked against a linear decode. A decode runs far past realtime, so a seek on a long track costs a fraction of a second on the worker.
Checked
HE-AAC v1 MP4, HE-AAC v2 ADTS and HE-AAC v2 MP4 from the Coding Technologies check package decode identical to ffmpeg, with SBR and PS intact at 44.1 kHz. A linear read and four seeks per file match bit for bit on LC M4A, LC ADTS and HE-AAC MP4.
Known limits
- Media Foundation does not apply the MP4 edit list or iTunSMPB, so an M4A starts with about 1024 frames of encoder delay and keeps a short tail. Fine for tracks, audible on a tight loop.
- A stream whose format changes mid file ends at the change and keeps what was decoded. The log says so.
- Only the first audio stream of a file is read.
Tags
apps/eq/id3.cpp reads MP4 ilst under moov udta meta for title, artist (aART only when there is no artist), album and covr. moov may sit after the audio, so the top level is walked with seeks and only moov is read. An ADTS file takes its tags from an ID3v2 prefix like an MP3.
isolenui::audio and are shared by any app that links it.