roar_vs_new_simple(3)

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

πŸ’– roar_vs_new_simple β€” bestie, let's make a VS object πŸ’–

okay so this is page roar_vs_new_simple(3) from the RoarAudio Programmer's Manual and it's literally about birthing brand-new VS objects. we're so back.


✨ NAME ✨

roar_vs_new_simple, roar_vs_new_playback β€” Create new VS objects 🫢


✨ SYNOPSIS ✨

#include <roaraudio.h>

roar_vs_t * roar_vs_new_simple(const char * server, const char * name,
int rate, int channels, int codec, int bits, int dir, int * error);

roar_vs_t * roar_vs_new_playback(const char * server, const char * name,
int rate, int channels, int codec, int bits, int * error);

✨ DESCRIPTION ✨

So these two functions make you a shiny new VS object, and here's the slay: it already comes with a connected data connection. no extra steps, no vibes check needed, it just connects for you πŸ’…

They connect to the server server using the application name name. and they take all your audio parameters as arguments: rate, channels, codec, bits. iconic.

roar_vs_new_simple() is the flexible one β€” it takes the stream direction as the parameter dir. you get to pick where the audio is going, main character energy fr fr.

roar_vs_new_playback() is basically roar_vs_new_simple()'s chill twin, except it doesn't take a direction parameter at all β€” it just uses ROAR_DIR_PLAY (waveform playback) automatically. the original says "expect that" btw, which is a lil typo moment, but the meaning is except that, we understood the assignment πŸ™ˆ. also important: it may be implemented as a macro, so no cap, don't be surprised.


✨ PARAMETERS ✨

  • server β€” the server you're connecting to. pass NULL and it'll use the defaults, easy peasy 🌸
  • name β€” the application name. this should be something a human can actually use to identify the app, yk? and listen: it MUST NOT be the application's binary name or the value of argv[0]. not the vibe. do not do that 🚫
  • rate, channels, codec, bits β€” the audio parameters for your new stream: sampling rate, number of channels per frame, the codec being used, and number of bits per sample. the whole glow-up package ✨
  • 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'd 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 honestly? highly recommended to use it so you can give the user good error messages. bestie, be kind to your users πŸ₯Ί

✨ RETURN VALUE ✨

On success, these calls hand you a brand-new VS object β€” slay πŸ’…

On error, NULL is returned. that's it. that's the whole story. 😭


✨ EXAMPLES ✨

FIXME

(yeah. it says FIXME. the docs said "we'll do it later" and honestly? relatable. not me being the example section πŸ’€)


✨ SEE ALSO ✨

roar_vs_new(3), roar_vs_new_from_file(3), roar_vs_close(3), roarvs(7), libroar(7), RoarAudio(7).

go read those too, iykyk πŸ¦‹


RoarAudio Β· June 2011 Β· that's the source, the version and the date, so consider yourself signed off β€” mwah, go write some audio code bestie πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from