MIX_CreateAudioDecoder(3)

πŸ“¦
version 3.2.4 Β· 2 versions
, in fedora 44

πŸ’– 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 to MIX_Init(). but β€” plot twist β€” it does not need an actual MIX_Mixer to 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 πŸ‘‘


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