MIX_GetTrackFadeFrames(3)

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

✨ NAME ✨

MIX_GetTrackFadeFrames</b> β€” it's giving "is this track fading rn??" πŸ’…

This page lives in the SDL_mixer3 FUNCTIONS section of the manual, bestie, so if you were looking for it there: found it. 🫢


🌸 SYNOPSIS 🌸

#include <SDL3_mixer/SDL_mixer.h>

Sint64 MIX_GetTrackFadeFrames(MIX_Track *track);

πŸ’– DESCRIPTION πŸ’–

Okay so here's the tea: this function very specifically checks that the track is _not stopped_ (so it's either paused or playing βœ…), and that it's currently fading in or fading out, and then it hands you back the number of frames still left in that fade. Literally the countdown to the end of the fade. ⏳✨

  • If it's fading out, the value you get back will be negative. πŸ“‰
  • If it's fading in, the value you get back will be positive. πŸ“ˆ
  • If it's not fading at all, this function returns zero. 😐
🚨 And now the part nobody likes: on various errors (MIX_Init() was not called, the track is NULL), this also returns 0. There is no mechanism to distinguish errors from tracks that aren't fading. So a zero could be "chill, no fade happening" or "everything is on fire" and the API is not about to tell you which. Bestie. πŸ’€ Not me having to warn you about this.

πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • track β€” the track you wanna query, queen. πŸ‘‘

πŸ¦‹ RETURN VALUE πŸ¦‹

  • less than 0 β†’ the track is fading out πŸ“‰
  • greater than 0 β†’ the track is fading in πŸ“ˆ
  • 0 β†’ otherwise, i.e. not fading (or an error, see above, iykyk 😭)

🌈 THREAD SAFETY 🌈

It is safe to call this function from any thread. Slay. No locking drama, no anxiety, just vibes. ✨


πŸ‘‘ AVAILABILITY πŸ‘‘

This function is available since SDL_mixer 3.0.0. So if you're on something ancient, this is not your era, bestie. πŸ•°οΈ


k bye, that's the whole page πŸŽ€ this was written for SDL_mixer 3.2.4, and the manual section is MIX_GetTrackFadeFrames(3) β€” mwah, go query your fades, main character πŸ’…πŸ’–

πŸ“¦ where this page comes from