MIX_SetTrackGain(3)

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

πŸ’– MIX_SetTrackGain(3) πŸ’–

okay bestie, welcome to the SDL_mixer3 FUNCTIONS corner of the manual, where we're talking about MIX_SetTrackGain β€” the little function that decides how loud one specific track is gonna be. yes, per-track. yes, it's iconic. let's get into it πŸŽ€


✨ NAME ✨

MIX_SetTrackGain β€” set a track's gain control. that's it, that's the whole job 🫢


🌸 SYNOPSIS 🌸

#include <SDL3_mixer/SDL_mixer.h>

bool MIX_SetTrackGain(MIX_Track *track, float gain);

πŸ¦‹ DESCRIPTION πŸ¦‹

so. every single track has its own gain, right? and that gain is literally just a lil knob for its overall volume. every sample coming out of that track gets modulated by this gain value. slay.

here's the vibe check on the numbers, no cap:

  • a gain of zero generates silence πŸ”‡
  • 1.0f will not change the mixed volume
  • larger than 1.0f will increase the volume πŸ”₯
  • negative values are illegal πŸ’€ don't even try it
⚠️ there's no maximum gain specified, but this can quickly get extremely loud, so please be careful with this setting. fr fr. your ears are not the main character here, protect them πŸ™ˆ

a track's gain defaults to 1.0f. cute, right? and you can change this value at any time to adjust the future mix. live adjustments, periodt πŸ’…


πŸ‘‘ FUNCTION PARAMETERS πŸ‘‘

  • track β€” the track to adjust. the one you're giving a glow-up to ✨
  • gain β€” the new gain value.

⭐ RETURN VALUE ⭐

returns true on success or false on failure πŸ₯² β€” and if it fails, call SDL_GetError() for more information. always check, bestie, it's giving responsible.


🌈 THREAD SAFETY 🌈

it is safe to call this function from any thread. yes queen, go wild, multitask, it's fine 🧚


πŸŽ€ AVAILABILITY πŸŽ€

this function is available since SDL_mixer 3.0.0. so if you're on anything older, sorry babe, it's not there 😭


πŸ’œ SEE ALSO πŸ’œ


and that's the whole page, bestie! this was brought to you by SDL_mixer 3.2.4 (the version this page ships with), from the SDL_mixer era of the manual. go forth and gain responsibly πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from