roar_vs_sync(3)

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

πŸ’– roar_vs_sync(3) β€” the RoarAudio Programmer's Manual πŸ’–

okay bestie, sit down, we're learning roar_vs_sync today and honestly? it's giving "flushing my whole vibe to the server". this is part of the RoarAudio Programmer's Manual, so you already know it's about talking to your audio server. let's go πŸŽ€


✨ NAME ✨

roar_vs_sync β€” sync that VS object with the server, periodt πŸ’…


🌸 SYNOPSIS 🌸

#include <roaraudio.h>

int     roar_vs_sync (roar_vs_t * vss, int wait, int * error);

that's it, that's the whole vibe. three args, one int back πŸ¦‹


🫢 DESCRIPTION 🫢

so like. this function syncs your local data buffers with the server by flushing them. that's the whole job. it takes your buffered stuff and pushes it out there so the server actually sees it. iconic behavior honestly.

the wait parameter is the drama of it all β€” it tells the function whether it should also wait for the flushed data to actually be played. other sound systems call this drain, iykyk. and listen: this mode is not recommended except at the very end of the stream, because it will literally result in buffer underruns. like, that's not a maybe. it's a will. so don't be messy about it 😭

and a super important lil note that people always miss: this function only flushes IO buffers, not the ring buffers when you're in buffered mode. if that's what you need, go call roar_vs_iterate(3) or roar_vs_run(3) instead. don't come for this function, it does exactly what it says on the tin ✨


πŸ’… PARAMETERS πŸ’…

  • vss β€” the VS object you want to be synced. your main character, basically πŸ‘‘
  • wait β€” says whether the call should block until all the data has been played. it must be ROAR_VS_WAIT or ROAR_VS_NOWAIT. no other options, no in-between, pick a lane 🚦
  • error β€” a pointer to an int where the error value gets stashed if something goes wrong. it can be NULL if you're not using it, but bestie... it is very recommended that you use it, because that's how you report good error messages to your user. don't leave your users out here confused πŸ™ˆ

⭐ RETURN VALUE ⭐

  • on success? these calls return 0. we love a clean zero πŸ’–
  • on error? -1 is returned. and that's when you're glad you passed in that error pointer fr fr πŸ’€

🌈 NOTES 🌈

this function uses the WAIT protocol command when wait is set to ROAR_VS_WAIT. and heads up β€” this is not supported by all servers. so if you go poking at that and nothing happens, it might not be you. it's the server. not you, babe 🫢


🧚 EXAMPLES 🧚

FIXME

...yeah. that's what it says. the docs said FIXME. we respect the FIXME. 😭


πŸ’œ SEE ALSO πŸ’œ

go read those too, they're all part of the family 🌸


and that's the whole page bestie!! stay synced, stay flushed, and please don't drain unless it's the end of the stream πŸ’€πŸ’–

β€” written by RoarAudio, dated May 2011, and it's still serving to this very day. slay πŸ’…βœ¨

πŸ“¦ where this page comes from