MIX_DestroyTrack(3)

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

✨ MIX_DestroyTrack ✨

okay bestie, welcome to MIX_DestroyTrack(3) β€” it's a page from the SDL_mixer3 girlies (that's the manual section, keep up πŸ’…) and it's all about yeeting a track into the void. bye boo πŸ‘‹


🌸 NAME 🌸

MIX_DestroyTrack β€” destroy the specified track. that's it. that's the whole vibe. πŸ’€


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3_mixer/SDL_mixer.h>

void MIX_DestroyTrack(MIX_Track *track);

like, one include, one function call. so simple. so iconic. ✨


πŸ’– DESCRIPTION πŸ’–

okay so here's the tea, and you need to hear it β˜•

If the track is currently playing, it gets stopped immediately β€” no fadeout, no gentle exit, no little goodbye wave 😭 it's just gone. Instant. Like your ex's attention span.

And if there's a callback set through MIX_SetTrackStoppedCallback(), it will _not_ be called. Not even a little bit. Not once. Don't @ me. πŸ™ˆ that's just how it is.

If the mixer is currently mixing in another thread, this will block until it finishes. like it will literally sit there and wait its turn, very demure, very mindful 🧚

Now this next part is the important one, so listen up πŸ‘‘

Destroying a track from the mixer thread itself (during a callback) will cause it to be destroyed as soon as this iteration of the mixer thread is not using it. slay, scheduling! πŸ¦‹

BUT β€” in this scenario, destroying a track and then making futher changes to it is considered undefined behavior. 🚨 that means all bets are off, the universe stops making sense, no cap. do not touch it after you destroy it. periodt. πŸ’€

Last thing, and it's a cute one: destroying a NULL MIX_Track is a legal no-op. so if you pass in nothing, it's fine, it just vibes. no crash, no drama, no main character meltdown. πŸ’…


🌈 FUNCTION PARAMETERS 🌈

  • track β€” the track to destroy. yeah. the one you're destroying. the one and only. give it here 🫢

⭐ THREAD SAFETY ⭐

It is safe to call this function from any thread. any of them. all of them. go feral, bestie, the thread police are not coming πŸ”₯


πŸ‘‘ AVAILABILITY πŸ‘‘

This function is available since SDL_mixer 3.0.0. so she's been here a minute, she's not new money πŸ’œ


okay that's the whole page!! go forth and destroy tracks responsibly 🌸

shoutout to the SDL_mixer girlies for this one, straight from the manual, version SDL_mixer 3.2.4 β€” mwah, love you, bye πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from