roar_vs_file(3)
π roar_vs_file β the RoarAudio Programmer's Manual, but make it cute π
okay bestie, sit down, we're doing file mode today and honestly? it's giving main character energy. this is roar_vs_file(3) from the RoarAudio fam, and if you're here it's because you want the VS API to read from or write to a file (or a URL, we don't discriminate π
).
β¨ NAME β¨
roar_vs_file, roar_vs_file_simple, roar_vs_new_from_file β file mode for the VS API π
πΈ SYNOPSIS πΈ
#include <roaraudio.h>
int roar_vs_file(roar_vs_t * vss, struct roar_vio_calls * vio, int
closefile, int * error);
int roar_vs_file_simple(roar_vs_t * vss, char * filename, int * error);
roar_vs_t * roar_vs_new_from_file(const char * server, const char *
name, char * filename, int * error);
π¦ DESCRIPTION π¦
so these three functions are the way you open a VS object in file mode. and what is file mode, you ask? it's when the VS API literally just reads the data from the file or writes the data to the file itself. no drama, no middleman. and because file mode uses normal VIO/DSTR, it supports streams too β so yeah, you can just pass a stream URL as the filename and it will absolutely eat that up. periodt. π
roar_vs_file()β sets up file mode for an object you already opened, using the open VIO handlevio. lowkey important: this one requires you to useroar_vs_stream(3).roar_vs_file_simple()β sets up file mode from a givenfilename(or URL) and opens the file with the DSTR API. by default it assumes playback mode and tries to auto detect the audio parameters. want to override that auto detection or go a different stream direction? that's aroar_vs_stream(3)job, bestie.roar_vs_new_from_file()β creates a brand new VS object and drops it straight into file mode using the file (or URL) you passed asfilename.
and to actually send data to it or read data from it, you use roar_vs_iterate(3) or roar_vs_run(3). slay. π«Ά
π PARAMETERS π
serverβ the server to connect to.NULLfor defaults. (yes,NULLis a valid vibe.)nameβ the application name. this should be something the user can use to identify the application. it MUST NOT be the application's binary name or the value ofargv[0]. like, do not do that. πvioβ the VIO handle that file mode is gonna use.closefileβ tells file mode whether the file should be closed onroar_vio_close(3). must beROAR_VS_TRUE(the common one) orROAR_VS_FALSE.filenameβ the filename used to open the file for file mode. the file is opend using the DSTR API. every kind of file DSTR supports is supported here β yes, that includes HTTP streams. πerrorβ a pointer to an integer that stores the error value in case of error. you can passNULLif you're not using it, but ngl it is very recommended to use this error value so you can report good error messages to the user. your future self will thank you π
π RETURN VALUE π
on success, roar_vs_new_from_file() returns a shiny new VS object. β¨ on error, NULL is returned. roar_vs_file() and roar_vs_file_simple() return 0 on success and -1 on error. iconic behavior, honestly.
π₯ EXAMPLES π₯
here's the whole vibe, copy it and go:
roar_vs_t * vss;
int err;
vss = roar_vs_new_from_file(NULL, "MyApp", "http://...", &err);
if ( vss == NULL ) {
//handle error.
}
if ( roar_vs_run(vss, &err) == -1 ) {
//handle error.
}
if ( roar_vs_close(vss, ROAR_VS_FALSE, &err) == -1 ) {
//handle error.
}
π SEE ALSO π
roar_vs_new_simple(3), roar_vs_iterate(3), roar_vs_run(3), roar_vs_close(3), roarvs(7), libroar(7), RoarAudio(7).
no cap: if you're touchingname, remember it's for the user to identify the app β not your binary name, notargv[0]. that's the one rule that will get you every time. π
and that's the whole page, bestie π«Ά this one's brought to you by RoarAudio, dated June 2011 β yeah, she's vintage, she's classic, she's still slaying. mwah π π
π¦ 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