MIX_SetTagGain(3)

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

πŸ’– MIX_SetTagGain(3) πŸ’–

okay bestie, welcome to the SDL_mixer3 corner of the man pages, this one's all about MIX_SetTagGain and it's lowkey a banger. sit down, hydrate, let's go 🫢


✨ NAME ✨

MIX_SetTagGain β€” set the gain control of all the tracks with a specific tag. like, one call, every track wearing that tag, volume adjusted. iconic behavior fr fr πŸ‘‘


🌸 SYNOPSIS 🌸

#include <SDL3_mixer/SDL_mixer.h>

bool MIX_SetTagGain(MIX_Mixer *mixer, const char *tag, float gain);

πŸ¦‹ DESCRIPTION πŸ¦‹

so, real talk: every track has its own gain, and that's the thing that tweaks its overall volume. every single sample coming out of that track gets modulated by this gain value. the math is giving:

  • gain of zero β†’ silence, literally nothing, mime hours 🀫
  • 1.0f β†’ does not change the mixed volume at all, it's just vibing
  • larger than 1.0f β†’ volume goes up

Negative values are illegal. don't do it. the system said no.

⚠️ okay so there is no maximum gain specified, but bestie this can quickly get EXTREMELY loud?? like ears-ringing loud. please be careful with this setting, i am begging πŸ™ˆπŸ”Š

a track's gain defaults to 1.0f, no cap.

what this function does specifically: it changes the gain control on tracks on the specified mixer that have the specified tag. so like, tag-based volume control, very ✨organized✨ of you.

and here's the slay part β€” from the point of view of the mixing process, all tracks that successfully change gain values will do so at the exact same moment. synchronized. choreographed. no awkward stagger. periodt πŸ’…

this value can be changed at any time to adjust the future mix. whenever. go off.


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • mixer β€” the mixer on which to look for tagged tracks. this is where the hunting happens πŸ•΅οΈβ€β™€οΈ
  • tag β€” the tag to use when searching for tracks. the vibe check, essentially
  • gain β€” the new gain value. the new volume situation

⭐ RETURN VALUE ⭐

Returns true on success or false on failure. and if it goes sideways, call SDL_GetError() for more information β€” that's your receipt bestie 🧾


πŸ”₯ THREAD SAFETY πŸ”₯

It is safe to call this function from any thread. any of them. all of them. go wild (responsibly) 🌈


πŸ’œ AVAILABILITY πŸ’œ

This function is available since SDL_mixer 3.0.0. she's been here a minute πŸ‘‘


🌸 SEE ALSO 🌸


okay that's the whole page!! this was SDL_mixer version 3.2.4, page date MIX_SetTagGain(3), brought to you by the SDL_mixer girlies πŸ’– go set some tag gains and stay hydrated, ily, bye!! βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from