MIX_Track...dCallback(3type)
π NAME π
MIX_TrackStoppedCallback β the lil callback that goes off when a MIX_Track gets stopped, bestie. it's giving "the track said i'm done" energy π
so this is from the SDL_mixer3 DATATYPES manual page, and yes we're gonna read the whole thing together, no skipping π«Ά
β¨ SYNOPSIS β¨
#include <SDL3_mixer/SDL_mixer.h>
typedef void (SDLCALL *MIX_TrackStoppedCallback)(void *userdata, MIX_Track *track);
look at that function pointer signature, she's iconic, she's literally art π
πΈ DESCRIPTION πΈ
okay so here's the tea β β this callback fires when a track completes playback. and there are exactly two ways that happens:
- it ran out of data to mix (and all the loops were completed too, every single one, no cap π)
- or the app explicitly stopped it
and here's the thing β pausing a track will NOT fire this callback. pausing is not stopping, they are different vibes, do not @ me π
it is legal to adjust the track in here, including changing its input and restarting it. fr fr you can do that π
and if you do that because it ran out of data in the middle of mixing, the mixer will start mixing the new track state in its current run without any gap in the audio. no glitch, no crackle, seamless, slay β¨
β οΈ also important: this callback will NOT fire when a playing track is destroyed. destroyed is not stopped, periodt π
π FUNCTION PARAMETERS π
userdataβ an opaque pointer that the app provides for its own personal use. it's yours, do whatever, we don't peek πtrackβ the track that has stopped. that's the one, that's her π
π¦ AVAILABILITY π¦
this datatype has been available since SDL_mixer 3.0.0. vintage, but like, in a good way π
π SEE ALSO π
MIX_SetTrackStoppedCallback(3)β go read her next, she's the one who sets this whole thing up π«Ά
okay bestie that's the whole page, you ate that π this was MIX_Track...dCallback(3type) from the SDL_mixer manual, brought to you by SDL_mixer 3.2.4 β go forth and stop some tracks, main character energy only β¨ππ
π¦ 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