MIX_LoadRawAudio_IO(3)
π MIX_LoadRawAudio_IO π
okay bestie, welcome to page MIX_LoadRawAudio_IO(3) from the SDL_mixer3 FUNCTIONS collection β yes we're in the SDL_mixer 3 era, we're thriving. grab a strawberry π and let's get into it.
β¨ NAME β¨
MIX_LoadRawAudio_IO β load raw PCM data from an SDL_IOStream. that's it, that's the whole vibe. π
π SYNOPSIS π
#include <SDL3_mixer/SDL_mixer.h>
MIX_Audio * MIX_LoadRawAudio_IO(MIX_Mixer *mixer, SDL_IOStream *io, const SDL_AudioSpec *spec, bool closeio);
look at her. four parameters, one pointer return, zero drama. π«Ά
πΈ DESCRIPTION πΈ
okay so first thing, bestie, there are other options for _streaming_ raw PCM. you can connect an SDL_AudioStream to a track, and you can connect an SDL_IOStream to a track too, and they'll read from those sources on-demand β like, right when it's time to mix the audio. very on demand, very main character energy. π§
This function though? This function is the other flavor. It's useful for loading static audio data that is meant to be played multiple times. Like, the song you keep replaying. iykyk. π
And what it does is: it loads the raw data in its entirety and caches it in RAM. all of it. in memory. no cap. π§ β¨
Also super important: MIX_Audio objects can be shared between multiple mixers. The mixer parameter just suggests the most likely mixer to use this audio with, in case some optimization might be applied β but this is not required, and a NULL mixer may be specified. so the mixer arg is like, a hint, a vibe check, not a binding contract. π«
π₯ FUNCTION PARAMETERS π₯
mixerβ a mixer this audio is intended to be used with. May beNULL. (she's just a suggestion bestie π)ioβ theSDL_IOStreamto load data from. π₯specβ what format the raw data is in. like, tell her what she's looking at. πcloseioβtrueif SDL_mixer should closeiobefore returning β and that's success or failure, so literally every return path. if you saytrue, she's closing it, periodt. π
β RETURN VALUE β
Returns an audio object that can be used to make sound on a mixer πΆ β or NULL on failure. on failure, call SDL_GetError() for more information. (yeah, go ask her what went wrong, she'll tell you π)
π§ THREAD SAFETY π§
It is safe to call this function from any thread. β¨ go forth and thread, queen. π
π¦ AVAILABILITY π¦
This function is available since SDL_mixer 3.0.0. vintage-ish but make it cunty. π
π SEE ALSO π
MIX_DestroyAudio(3)MIX_SetTrackAudio(3)MIX_LoadRawAudio(3)MIX_LoadRawAudioNoCopy(3)MIX_LoadAudio_IO(3)
the whole little friend group π«Ά go read them too, they're all iconic in their own way.
fr fr reminder bestie: this one eats your raw PCM whole and keeps it in RAM, so if you wanted the lazy on-demand streaming vibe, that's the other options, not this one. know the difference. ππ
k bye, this page is from the SDL_mixer manual, version SDL_mixer 3.2.4 β mwah, go load some audio, you absolute icon ππβ¨
π¦ 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