MIX_GetTrackRemaining(3)
โจ MIX_GetTrackRemaining(3) โจ
okay bestie, welcome to the SDL_mixer3 FUNCTIONS corner of the manual ๐ this one lives in the SDL_mixer3 family, and it's all about finding out how much audio is still left in a track. it's giving "are we there yet" but for sample frames ๐
๐ธ NAME ๐ธ
MIX_GetTrackRemaining โ returns the number of sample frames remaining to be mixed in a track. no cap, that's literally the whole job ๐
๐ฆ SYNOPSIS ๐ฆ
#include <SDL3_mixer/SDL_mixer.h>
Sint64 MIX_GetTrackRemaining(MIX_Track *track);
๐ DESCRIPTION ๐
so here's the tea ๐ โ if the track is playing or paused, and its total duration is known, this function will report how much audio is left to mix. and if the track is playing? every future call will report a different value, because time keeps on slippin' (into the future) โณโจ
remaining audio is defined in _sample frames_ of decoded audio, not units of time, so that sample-perfect mixing can be achieved. if you'd rather operate in units of time instead, use MIX_TrackFramesToMS() to convert the return value to milliseconds ๐ง
heads up: this function does not take into account fade-outs or looping โ it's just the current mixing position vs. the duration of the track. periodt ๐
if the duration of the track isn't known, or track is NULL, this function returns -1. a stopped track reports 0. iconic behaviour honestly ๐
๐ FUNCTION PARAMETERS ๐
trackโ the track to query. that's your main character right there ๐ซถ
๐ RETURN VALUE ๐
returns the total sample frames still to be mixed, or -1 if unknown. so either a nice number or a mystery โจ๐ฎ
๐ฅ THREAD SAFETY ๐ฅ
it is safe to call this function from any thread. go forth, multithread, slay ๐
โญ AVAILABILITY โญ
this function is available since SDL_mixer 3.0.0 โ so it's been here for a minute, fr fr ๐
and that's the whole page, bestie!! you just read MIX_GetTrackRemaining(3) from SDL_mixer 3.2.4 (yep, the SDL_mixer source, version 3.2.4) โ go convert some frames to milliseconds and live your sample-perfect truth ๐
๐๐๐ฆ๐ธ
๐ฆ 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