roar_vs_stream(3)

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

πŸ’– 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 the roar_audio_info structure, 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), and codec. yes all four, no skipping. 🌈
  • dir β€” the stream direction. common values include ROAR_DIR_PLAY for waveform playback, ROAR_DIR_MONITOR for waveform monitoring, and ROAR_DIR_RECORD for waveform recording. for MIDI you use ROAR_DIR_MIDI_IN and ROAR_DIR_MIDI_OUT. pick your fighter. πŸ’«
  • error β€” a pointer to an integer where the error value gets stored if something goes wrong. you can pass NULL if 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