MIX_LoadAudio(3)

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

πŸ’– MIX_LoadAudio(3) πŸ’–

okay bestie, welcome to the SDL_mixer3 FUNCTIONS section of the manual, and today's main character is MIX_LoadAudio β€” she loads audio for playback from a file. that's it, that's the job, and she does it flawlessly. πŸŽ€


✨ NAME ✨

MIX_LoadAudio β€” load audio for playback from a file. literally her whole thing. πŸ¦‹


✨ SYNOPSIS ✨

#include <SDL3_mixer/SDL_mixer.h>

MIX_Audio * MIX_LoadAudio(MIX_Mixer *mixer, const char *path, bool predecode);

look at that signature. gorgeous. no notes. πŸ’…


✨ DESCRIPTION ✨

okay so. this function is exactly equivalent to calling this:

MIX_LoadAudio_IO(mixer, SDL_IOFromFile(path, "rb"), predecode, true);

periodt. copy that into your brain, because it's like, the whole personality of this function.

so MIX_LoadAudio pulls data from a path on the filesystem. that's her vibe β€” path in, audio out. 🌸

but bestie, if you want options, there are other girls for that:

  • there's a version that loads from an SDL_IOStream, and that one is called MIX_LoadAudio_IO()
  • and there's one that takes properties for ultimate control, MIX_LoadAudioWithProperties()

choose your fighter. 😌


✨ FUNCTION PARAMETERS ✨

  • mixer β€” a mixer this audio is intended to be used with. and guess what, she may be NULL. she's flexible like that. πŸ™ˆ
  • path β€” the path on the filesystem to load data from. give her a location, she'll go get the file. πŸ“
  • predecode β€” if true, data will be fully uncompressed before returning. like, all the way decompressed, before she hands it back to you. no half measures. πŸ”₯

✨ RETURN VALUE ✨

she returns an audio object that can be used to make sound on a mixer 🎢 β€” or NULL on failure. and if you get NULL, do not just sit there staring at it, call SDL_GetError() for more information. the error message is your friend. fr fr. 😭


✨ THREAD SAFETY ✨

it is safe to call this function from any thread. any of them. go wild. multithreaded queen behavior. πŸ‘‘


✨ AVAILABILITY ✨

this function has been available since SDL_mixer 3.0.0. so she's been serving for a minute. ⭐


✨ SEE ALSO ✨

go read those too, bestie, iykyk. πŸ’œ


and that's a wrap, my love β€” this page comes to you from SDL_mixer, version SDL_mixer 3.2.4, and all this wisdom lives on the MIX_LoadAudio(3) page. slay, stay hydrated, and may your pointers never be NULL. πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from