Search guides and the APICtrl K
  1. API reference
  2. Files and codecs

audiofile.h

Audio files beyond WAV.

#include <sonore/audiofile.h>
  • 13other declarations
On this page

Design notes

AIFF (and AIFF-C "sowt") because Mac-sourced sample libraries still ship it, and FLAC because impulse-response packs do. The FLAC decoder is OUR OWN implementation of the published format (no library, no licence to carry), and it is graded the only way a lossless codec honestly can be: decode and compare SAMPLE-EXACT against the same material as PCM (see sdk_tests).

MP3 and Ogg Vorbis come from vendored public-domain decoders (see audiofile_codecs.h) because there is nothing to differentiate in a Huffman table; FLAC and AIFF are ours because they are simple enough to own and to prove sample-exact.

Offline-only by design, like wav.h: these allocate and do file IO, so they belong in prepare()-time code and tools, never in process().

Everything funnels into the same WavData a caller already handles; readAudioFile() sniffs the magic and dispatches, so callers need not care which container the user dropped on them. An application that wants the operating system's decoders behind that (M4A, WMA...) opts in through system_audio_format.h; the set here stays the default.

Functions 12

Aliases 1

  • usingusing AudioFileFallback = bool (*)(const char* path, WavData* out)
    A decoder of last resort for readAudioFile: called with whatever the built-in decoders did not open -- a container none of them knows (M4A, WMA), or one they know carrying a codec they refuse (MP3 or ADPCM inside a RIFF). Null by default, which keeps the fixed set: a file opens or not by what the PLUGIN contains, identically on every machine.
    More

    system_audio_format.h is what installs one -- enableSystemAudioFormats() hands the operating system's decoders this slot -- and it is a slot rather than an #include because those decoders need <windows.h> and Media Foundation, which this header must not drag into every plugin that reads a WAV.

    audiofile.h:1084
↑↓ to move↵ to openEvery public name in the headers, and every guide