roar_vs_volume_get(3)
π roar_vs_volume_get β get or set volume for audio stream π
okay bestie, welcome to roar_vs_volume_get(3), straight outta the RoarAudio Programmer's Manual π this is your group chat for making a stream louder, quieter, or perfectly balanced, and honestly? the way these three functions just handle your volume? iconic.
β¨ NAME β¨
roar_vs_volume_get, roar_vs_volume_mono, roar_vs_volume_stereo β get or set volume for audio stream. that's the whole vibe, no cap. π
πΈ SYNOPSIS πΈ
#include <roaraudio.h>
int roar_vs_volume_get (roar_vs_t * vss, float * l, float * r,
int * error);
int roar_vs_volume_mono (roar_vs_t * vss, float c, int * error);
int roar_vs_volume_stereo (roar_vs_t * vss, float l, float r, int *
error);
look at those signatures, they're serving β¨ (and yes, copy them exactly, we do NOT freestyle headers here)
π DESCRIPTION π
okay so these functions are the volume girlies. they get or set volume for the given stream, that's the entire job description and they do it flawlessly.
roar_vs_volume_get()gets the volume for the given stream in stereo form, as a left and a right component (L/R). if you're a mono kinda person and you only need the mono volume? just divide the sum of both by two. easy math, see examples below πroar_vs_volume_mono()sets the mono volume for the stream. heads up though β balance information is not kept. it's giving "we don't do leftovers" πroar_vs_volume_stereo()sets the stereo volume for the stream, as left and right component (L/R). full main character energy, both channels addressed by name π
π PARAMETERS π
vssβ the VS object for which volume is get or set. your little stream bestie π«Άl,r,cβ the volume for left, right or center (mono) channel. value is afloatin range zero to one. Zero means this channel is fully muted. One means the channel is passed without altering the amplitude.
small numerical errors are detected and corrected β¨ bigger errors will result in a out of range error π
β οΈ note that to mute the stream you MUST NOT use volume setting but roar_vs_mute(3). seriously. don't. i'm not joking. go use the mute function, it's right there π
errorβ this is a pointer to a integer used to store the error value in case of error. this can beNULLif not used but it is very recommended to use this error value to report good error messages to the user. bestie, please pass your errors along, your users deserve to know what happened π
β RETURN VALUE β
on success these calls return 0. on error, -1 is returned. that's it. zero is the slay, negative one is the "oop" π
π¦ EXAMPLES π¦
getting mono volume:
float l, r, c;
int err;
if ( roar_vs_volume_get(vss, &l, &r, &err) == -1 ) {
/* handle error */
}
c = (l + r)/2.;
see? (l + r)/2. β the mono math is literally right there, ate and left no crumbs π₯
π SEE ALSO π
roarvs(7), libroar(7), RoarAudio(7). go read those too, iykyk π
and that's the page!! this was RoarAudio, from May 2011, originally living its life as roar_vs_volume_get(3) β mwah, thanks for reading bestie, go set some volumes responsibly πΈπβ¨
π¦ where this page comes from
- ubuntu jammy: libroar-dev 1.0~beta12-4 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms