SDL_GetAudioStreamGain(3)

πŸ’– SDL_GetAudioStreamGain(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're about to find out exactly how loud your audio stream is being. this is <pink>SDL_GetAudioStreamGain</pink> and yes she's a read-only queen, no cap. ✨


🌸 NAME 🌸

SDL_GetAudioStreamGain β€” get the gain of an audio stream. literally just asks the stream "how loud are we rn" and it tells you. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_audio.h>

float SDL_GetAudioStreamGain(SDL_AudioStream *stream);

πŸ’… DESCRIPTION πŸ’…

so the gain of a stream is basically its volume, okay? like, the vibe check on how loud things are gonna come out. a larger gain means a louder output, and a gain of zero is... silence. the void. the "everyone go home" setting. πŸ’€

and here's the tea: audio streams default to a gain of 1.0f, which means no change in output. so out of the box she's just her authentic self, no filter, no edits. 🫢


🌈 FUNCTION PARAMETERS 🌈

  • stream β€” the SDL_AudioStream to query. this is the one you're asking about. your main character stream. πŸ‘‘

⭐ RETURN VALUE ⭐

returns the gain of the stream, OR -1.0f on failure. 😭 and if it fails, you gotta call SDL_GetError() for more information β€” she'll tell you what went wrong, fr fr.


πŸ”₯ THREAD SAFETY πŸ”₯

good news bestie: it is safe to call this function from any thread! because it holds a stream-specific mutex while running. locked in. protected. no chaos. periodt. πŸ’–


πŸŽ€ AVAILABILITY πŸŽ€

this function is available since SDL 3.2.0. if you're on something older... girl, update. πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, mwah πŸ’‹ β€” brought to you by Simple Directmedia Layer, version SDL 3.4.18, and yes the page header/footer said the same thing, we're just saying it cuter. stay slay, keep your gain above zero, and call SDL_GetError() when things go wrong. byeeee πŸ’œβœ¨

πŸ“¦ where this page comes from