MIX_LoadRawAudio_IO(3)

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

πŸ’– 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 be NULL. (she's just a suggestion bestie πŸ’)
  • io β€” the SDL_IOStream to load data from. πŸ“₯
  • spec β€” what format the raw data is in. like, tell her what she's looking at. πŸ‘€
  • closeio β€” true if SDL_mixer should close io before returning β€” and that's success or failure, so literally every return path. if you say true, 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 🌈

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