MIX_SETTRACKFREQUENCYRATIO(3)
π MIX_SetTrackFrequencyRatio π
okay bestie so this is MIX_SetTrackFrequencyRatio, a function from the SDL_mixer3 manual β literally the glow-up button for how fast a track's audio gets eaten up, speed AND pitch, all at once. slay.
β¨ NAME β¨
MIX_SetTrackFrequencyRatio β change the frequency ratio of a track. that's it, that's the whole job π
πΈ SYNOPSIS πΈ
#include <SDL3_mixer/SDL_mixer.h>
bool MIX_SetTrackFrequencyRatio(MIX_Track *track, float ratio);
look at her. two args, returns a bool. clean, iconic, no cap.
π¦ DESCRIPTION π¦
so the frequency ratio is the thing that decides the rate at which audio data is consumed. when you change it, you're effectively messing with the speed and the pitch of that track's audio at the same time. it's giving DJ booth. it's giving chipmunk. it's giving slow-mo dramatic flashback. your call π
here's the vibe math:
- a value greater than
1.0fplays the audio faster, and at a higher pitch πΏοΈ - a value less than
1.0fplays the audio slower, and at a lower pitch π’ 1.0fis normal speed. the baseline. the stock photo. the "no notes" default β
the default value is 1.0f btw. remember that.
and the best part: this value can be changed at any time to adjust the future mix. you're not locked in. you can just keep tweaking it while everything's running, which is kind of the whole point π«Ά
π FUNCTION PARAMETERS π
trackβ the track on which to change the frequency ratio. it's the one getting the makeover β¨ratioβ the frequency ratio. must be between0.01fand100.0f. going outside that range? not the move. don't do it π
π RETURN VALUE π
returns true on success, or false on failure. and if it fails, bestie, go call SDL_GetError() for more information β she'll tell you what went wrong π
π THREAD SAFETY π
it is safe to call this function from any thread. yes, ANY. go wild, she's built different π₯
π AVAILABILITY π
this function is available since SDL_mixer 3.0.0. vintage, but make it fresh.
β SEE ALSO β
MIX_GetTrackFrequencyRatio(3)β the read-only sister function, for when you just wanna know what the ratio currently is. iykyk.
okay that's the whole page, no notes, you ate π
and for the credits moment: this gorgeousness lives in the SDL_mixer manual, version SDL_mixer 3.2.4, and the whole thing is titled MIX_SetTrackFrequencyRatio(3). periodt. π¦πβ¨
π¦ 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