decoder.h¶
| File Path | engine/include/conjure/audio/decoder.h |
| API ↗ | Clips and decoding |
Decoding. Everything here goes through miniaudio's decoders (WAV, MP3, FLAC built in, Ogg Vorbis through stb_vorbis compiled into the miniaudio translation unit) and is backend independent: the null backend decodes exactly like the real one. Safe to call from any thread; a streaming_decoder instance is used by one thread at a time.
Structs¶
| File | Description |
|---|---|
decode_options |
Options of decode_to_pcm: downmix to mono, resample (0 keeps the source rate) and scale the peak to 1. |
Classes¶
| File | Description |
|---|---|
streaming_decoder |
Incremental decoder over caller-owned encoded bytes, used by streamed voices. |
Forward Declarations¶
streaming_decoder::state¶
Functions¶
Public¶
decode_to_pcm¶
decode_to_pcm¶[[nodiscard]] CONJURE_API core::result<pcm_buffer> decode_to_pcm(
std::span<const byte> encoded,
const decode_options &options);Decodes a whole file to interleaved f32 at its native channel count and rate, then applies the options in order: forceMono, sampleRate (miniaudio linear resampler), normalize. Same errors as probe().
probe¶
probe¶[[nodiscard]] CONJURE_API core::result<clip_info> probe(
std::span<const byte> encoded);Opens a decoder to read format and length. Errors: INVALID_CLIP (empty), UNSUPPORTED_FORMAT (unknown magic), DECODE_FAILED (miniaudio refused the data; the message names its result).
sniff_encoding¶
sniff_encoding¶[[nodiscard]] CONJURE_API clip_encoding sniff_encoding(
std::span<const byte> encoded) noexcept;Sniffs the container magic (RIFF/WAVE, OggS, ID3 / MP3 sync, fLaC). UNKNOWN when none matches.