roar_vs_stream(3)
π roar_vs_stream π
okay bestie, so we're in the RoarAudio Programmer's Manual and today's main character is roar_vs_stream(3) β the function that sets up your stream params on a VS object. it's giving "let me introduce you to your own audio stream" energy and honestly? we're obsessed. β¨
β¨ NAME β¨
roar_vs_stream β set up stream parameters for a VS object π
πΈ SYNOPSIS πΈ
#include <roaraudio.h>
int roar_vs_stream(roar_vs_t * vss, const struct roar_audio_info * info,
int dir, int * error);
π¦ DESCRIPTION π¦
so what this function does is: it asks a VS object β one that you already opened with roar_vs_new_from_con(3) or roar_vs_new(3) β to open the data connection, using the audio parameters in info and the stream direction in dir. literally just "here's my format, here's my direction, open the connection bestie". π
if you made the VS object with one of those functions up there, you have to call this before you read or write any data. no cap, it's required. π
it also does double duty: it's how you provide parameters for the file mode, which you start by using roar_vs_file(3) or roar_vs_file_simple(3). but here's the tea β if you're just playing back a file, you usually don't need to do this, because the VS API will try to figure out the correct parameters on its own. it is required for all other stream directions though. peek roar_vs_file(3) and roar_vs_file_simple(3) for the full story. π₯
and good news: if it fails, you can just call it again with different parameters. it's not a one-shot deal, you can retry. slay. π
π PARAMETERS π
vssβ the VS object you're updating. the star of the show. πinfoβ a pointer to theroar_audio_infostructure, which stores all your audio format parameters. inside it you'll find these members:rate(the sample rate),bits(bits per sample),channels(channels per frame), andcodec. yes all four, no skipping. πdirβ the stream direction. common values includeROAR_DIR_PLAYfor waveform playback,ROAR_DIR_MONITORfor waveform monitoring, andROAR_DIR_RECORDfor waveform recording. for MIDI you useROAR_DIR_MIDI_INandROAR_DIR_MIDI_OUT. pick your fighter. π«errorβ a pointer to an integer where the error value gets stored if something goes wrong. you can passNULLif you're not using it, but fr fr it is very recommended that you use it, so you can give your user a good error message instead of just... vibes and silence. π
β RETURN VALUE β
on success these calls return 0. on error, -1 is returned. that's it, that's the whole thing. periodt. π
π₯ EXAMPLES π₯
struct roar_audio_info info;
int err;
if ( roar_profile2info(&info, "isdn-eu") == -1 ) {
// error handling.
}
if ( roar_vs_stream(vss, &info, ROAR_DIR_PLAY, &err) == -1 ) {
// error handling.
}
π SEE ALSO π
roar_vs_file(3), roar_vs_file_simple(3), roarvs(7), libroar(7), RoarAudio(7).
go read them, iykyk. π«Ά
okay that's the whole page bestie, you ate that. now go forth and open your data connection. π§
mwah π this page came to you from RoarAudio, dated June 2011 β take care of her, she's iconic. π β¨
π¦ 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