roar_vs_position(3)
π roar_vs_position(3) β the RoarAudio Programmer's Manual, but make it cute π
okay bestie, sit down, hydrate, and let me tell you about three functions that tell you where your stream is at. literally. like, positionally. it's in the RoarAudio Programmer's Manual and it's lowkey iconic. π
β¨ NAME β¨
roar_vs_position, roar_vs_latency, roar_vs_latency2 β get stream position information π¦
β¨ SYNOPSIS β¨
#include <roaraudio.h>
ssize_t roar_vs_position(roar_vs_t * vss, int backend, int * error);
roar_mus_t roar_vs_latency(roar_vs_t * vss, int backend, int * error);
roar_mus_t roar_vs_latency2(roar_vs_t * vss, int backend, int wait, int
* error);
like yes, three of them, all holding hands. π
β¨ DESCRIPTION β¨
so. roar_vs_position() hands you the current server site position of the stream, plus the current offset for whichever backend you picked. that's it. that's the vibe. β¨
roar_vs_latency() gives you the latency between the client site stream position and the server site position β plus the latency added by the backend.
π¨ bestie, listen. using roar_vs_latency() is not recommended. why? because it requires the codec to use a true constant bit rate. no cap. if that's not your codec's whole deal, this function is not your friend. π
roar_vs_latency2() is perfectly equivalent to roar_vs_latency() β except it takes the extra parameter wait. and wait is a whole personality:
- if
waitisROAR_VS_WAIT, the function does exactly the same thing asroar_vs_latency()π«Ά - if
waitisROAR_VS_NOWAIT, thenroar_vs_latency2()returns interpolated data based on old data collected by calls toroar_vs_latency(),roar_vs_latency2()orroar_vs_position(). yes, it's reusing the receipts from earlier calls. π§ ROAR_VS_ASYNCis used to trigger asyncron updates to this internal state. and heads up: asyncron operations need to be enabled before they can be used. seeroar_vs_ctl(3). π₯
and now the part nobody wants to hear: calling these functions too often will result in bad performance and incorrect data (that's when your pool interval is smaller than the server response time π). the good news? polling up to 20 times per second shoudn't be a problem. so chill, you don't need to spam it. π
β¨ PARAMETERS β¨
vssβ the VS object you're using. your main character. πbackendβ the backend used for correction. this can be a stream ID of the stream to use as backend, or one of the special values defined by the constantsROAR_VS_BACKEND_*:ROAR_VS_BACKEND_NONEβ used to ask for no correction πROAR_VS_BACKEND_DEFAULTβ used to ask for the default correction. this should be used in all common cases. like, default to this, fr fr. π«ΆROAR_VS_BACKEND_FIRSTβ used to ask for correction based on the first primary stream on the same mixer.
waitβ tells the API if the call should wait or not. must beROAR_VS_WAIT,ROAR_VS_NOWAITorROAR_VS_ASYNC. β¨errorβ a pointer to a integer used to store the error value in case of error. this can beNULLif not used, but it is very recommended to use this error value so you can report good error messages to the user. bestie, please use it. your users deserve nice errors. π
β¨ RETURN VALUE β¨
roar_vs_position() returns the stream position on success and -1 on error. and stream position is the current position of the stream in units of samples (not frames!). not frames. NOT frames. π«
roar_vs_latency() returns the stream latency on success and zero on error. however β plot twist β zero is a valid value. π so:
- in case of error,
erroris set to the error - in case of no error but zero latency,
erroris cleared (set toROAR_ERROR_NONE)
and latency is retruned in mu-seconds (1/10^-6s). yes, mu-seconds. that's what the page says. π
β¨ EXAMPLES β¨
FIXME
ngl bestie the examples are literally just FIXME π iconic behaviour honestly. leaving it exactly as written, because that's the whole content of this section.
β¨ SEE ALSO β¨
roarvs(7), libroar(7), RoarAudio(7) π¦
and that's the tea, bestie β go forth and poll responsibly (max like 20 times a second, remember πΈ). this little number is from RoarAudio, dated June 2011, and it lives at roar_vs_position(3). 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