MIX_StopAllTracks(3)
π MIX_StopAllTracks(3) β from the SDL_mixer3 FUNCTIONS girlies π
okay bestie, sit down, we're talking about MIX_StopAllTracks from SDL_mixer β¨ this one's a classic.
β¨ NAME β¨
MIX_StopAllTracks β halt every single track that's currently playing, and if you want, let them fade out over time like the dramatic main characters they are π
β¨ SYNOPSIS β¨
#include <SDL3_mixer/SDL_mixer.h>
bool MIX_StopAllTracks(MIX_Mixer *mixer, Sint64 fade_out_ms);
β¨ DESCRIPTION β¨
so here's the tea π if fade_out_ms is greater than 0, the tracks do not stop mixing right away. instead they fade to silence over that many milliseconds, and then they stop. it's giving graceful exit, no cap π
and lowkey important: this is different from MIX_StopTrack(), which wants sample frames. this function takes milliseconds because different tracks might have different sample rates β so milliseconds is the only unit that's fair to everyone. periodt π«Ά
if a track ends normally while the fade-out is still in progress, the audio just stops there. the fade is not shortened to fit β even if the fade would last longer than the audio that's left, it doesn't get adjusted. it just... is what it is πΈ
once a track has finished any fadeout and come to a stop, it will call its MIX_TrackStoppedCallback, if any. and yes, it is legal to assign the track a new input and/or restart it during this callback β go off, you're allowed π¦
also, this function does not block new play requests from being made. it is completely legal to use this function to start fading all the currently-playing tracks, and then start other tracks playing normally while those fade-outs are still in progress. iconic behavior honestly β¨
β¨ FUNCTION PARAMETERS β¨
mixerβ the mixer on which to stop all tracks. the one running the whole situation πfade_out_msβ the number of milliseconds to spend fading out to silence before halting. use0to stop immediately, no fade, just gone π
β¨ RETURN VALUE β¨
returns true on success, false on error π₯² if it fails, call SDL_GetError() for the details β it will tell you what went wrong, fr fr.
β¨ THREAD SAFETY β¨
it is safe to call this function from any thread. yes gurl, any thread. go wild π₯
β¨ AVAILABILITY β¨
this function is available since SDL_mixer 3.0.0 π
β¨ SEE ALSO β¨
and that's the whole page bestie, you ate that π this was the SDL_mixer manual, SDL_mixer 3.2.4 era, no cap π bye ily, go stop some tracks πβ
π¦ 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