MIX_StopTag(3)
π MIX_StopTag(3) π
okay bestie, welcome to the SDL_mixer 3 girlies' corner of the manual β this one is MIX_StopTag, and it's genuinely one of the most satisfying little functions in the whole library. no cap. β¨
πΈ NAME πΈ
MIX_StopTag β halt every single track that's rocking a specific tag, and yeah, it can fade out over time if you want it to be dramatic about it. π
β¨ SYNOPSIS β¨
#include <SDL3_mixer/SDL_mixer.h>
bool MIX_StopTag(MIX_Mixer *mixer, const char *tag, Sint64 fade_out_ms);
π DESCRIPTION π
So here's the tea, bestie. π«
If fade_out_ms is greater than 0, the tracks don't just stop mixing instantly β no, they fade to silence over that many milliseconds before actually stopping. cinematic. gorgeous. a whole moment. π
Important distinction alert!! This is different from MIX_StopTrack(), which wants sample frames. This function takes milliseconds, because different tracks might have different sample rates, and the function is out here being thoughtful about it. π§
If a track ends normally while the fade-out is still in progress, the audio just stops right there β periodt. The fade is not adjusted to be shorter if it's going to last longer than the audio that's actually remaining. it's not gonna rush itself for anyone. π
Once a track has completed any fadeout and come to a stop, it will call its MIX_TrackStoppedCallback, if any. And here's the slay part: it is legal to assign the track a new input and/or restart it during this callback. π
Also, this function does not prevent new play requests from being made. it's stopping stuff, not gatekeeping. π
π FUNCTION PARAMETERS π
mixerβ the mixer on which to stop tracks. your main character mixer. πtagβ the tag to use when searching for tracks. this is how we find our targets, iykyk. πfade_out_msβ the number of milliseconds to spend fading out to silence before halting.0to stop immediately. zero drama, instant exit. π
β RETURN VALUE β
Returns true on success, false on error β and if it errors, call SDL_GetError() for the details. she will tell you what went wrong, bestie. π
π¦ THREAD SAFETY π¦
It is safe to call this function from any thread. go off, thread. π₯
π AVAILABILITY π
This function is available since SDL_mixer 3.0.0. OGs remember. π
π SEE ALSO π
that's the whole page, babe β you're officially fluent in MIX_StopTag. this documentation situation is brought to you by SDL_mixer 3.2.4, so shoutout to the version that made it all possible. now go fade something out with style. πβ¨π
π¦ 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