MIX_SETTRACKFREQUENCYRATIO(3)

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

πŸ’– 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.0f plays the audio faster, and at a higher pitch 🐿️
  • a value less than 1.0f plays the audio slower, and at a lower pitch 🐒
  • 1.0f is 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 between 0.01f and 100.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 ⭐


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