MIX_LoadAudio(3)
π 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 calledMIX_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 beNULL. 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β iftrue, 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
- 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