roar_vs_volume_get(3)

πŸ“¦ version 1.0~beta12, in ubuntu jammy

πŸŽ€ 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 a float in 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 be NULL if 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