MIX_CreateAudioDecoder(3)
π MIX_CreateAudioDecoder β bestie edition π
okay so you're in the SDL_mixer3 functions section of the manual, and today's main character is MIX_CreateAudioDecoder(3). sit down, hydrate, let's go π«Ά
β¨ NAME β¨
MIX_CreateAudioDecoder β make a MIX_AudioDecoder from a path on the filesystem. that's it, that's the whole vibe. πΈ
π SYNOPSIS π
#include <SDL3_mixer/SDL_mixer.h>
MIX_AudioDecoder * MIX_CreateAudioDecoder(const char *path, SDL_PropertiesID props);
look at her. two params, one return, zero drama. π
π¦ DESCRIPTION π¦
so like, most apps will not need this, okay? fr fr. SDL_mixer's usual interfaces will decode audio as needed, all on their own, no prompting, they're self-sufficient queens. no cap. π
BUT β and this is the tea β β if you want to decode an audio file into a memory buffer without playing it, then this interface offers that. it's giving "decoder only, no stage performance." π₯
This function allows properties to be specified. the whole point of that is to supply file-specific settings, like where to find SoundFonts for a MIDI file, etc. β¨ and in most cases, the caller should just pass a zero to specify no extra properties. lowkey the polite thing to do.
SDL_PropertiesID are discussed in SDL's documentation over at https://wiki.libsdl.org/SDL3/CategoryProperties if you wanna go deep, iykyk π
When you're done with the audio decoder, you can destroy it with MIX_DestroyAudioDecoder(). clean up after yourself bestie, it's not a phase, it's a lifestyle π§Ήβ¨
heads up!! this function requires SDL_mixer to have been initialized with a successful call toMIX_Init(). but β plot twist β it does not need an actualMIX_Mixerto have been created. so you can have a decoder without a mixer. it's giving independent woman energy π
π FUNCTION PARAMETERS π
pathβ the path on the filesystem from which to load data. that's your file, bestie, show me where it lives πpropsβ decoder-specific properties. may be zero. and honestly? probably is. π
β RETURN VALUE β
Returns an audio decoder, ready to decode. she's prepped, she's hydrated, she's ready to serve π₯π
π THREAD SAFETY π
It is safe to call this function from any thread. yes fr, any thread, no gatekeeping, we love an inclusive icon ππ«Ά
π AVAILABILITY π
This function is available since SDL_mixer 3.0.0. a classic, an OG, born in 3.0.0 and thriving ever since β¨
π SEE ALSO π
MIX_CreateAudioDecoder_IO(3)β the sibling, same energy, different file handle vibeMIX_DecodeAudio(3)β actually get those bytes outMIX_DestroyAudioDecoder(3)β the goodbye arc, tears will be shed π
the way that you now know literally everything about MIX_CreateAudioDecoder... obsessed. periodt. π
π
written up in SDL_mixer 3.2.4, straight out of the SDL_mixer source, and that's the whole page bestie β go forth and decode responsibly πΈππ¦
π¦ where this page comes from
- fedora 44: SDL3_mixer-doc 3.2.4-3.fc44 Β· Zlib AND (GPL-2.0-or-later OR LGPL-2.0-or-later)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms