MIX_Track...dCallback(3type)

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

πŸ’– 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 🌈


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