roar_vs_buffer(3)

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

πŸ’– roar_vs_buffer(3) β€” the RoarAudio Programmer's Manual, but make it make sense πŸ’–

okay bestie, so this is one of those pages from the RoarAudio programmer's manual (that's the roar_vs_* family, iykyk) and it's all about buffered mode on your VS object. lowkey niche, but let's get into it 🫢


✨ NAME ✨

roar_vs_buffer β€” the way you turn on and poke at buffered mode streams πŸ’…


🌸 SYNOPSIS 🌸

#include <roaraudio.h>

int roar_vs_buffer(roar_vs_t * vss, size_t buffer, int * error);

ssize_t roar_vs_get_avail_read(roar_vs_t * vss, int * error);

ssize_t roar_vs_get_avail_write(roar_vs_t * vss, int * error);

int     roar_vs_reset_buffer(roar_vs_t * vss, int writering, int
readring, int * error);

πŸ¦‹ DESCRIPTION πŸ¦‹

so these functions are the ones that control the buffered mode of the VS object. and like… the manpage itself says using this mode is not recommended 😭 so keep that in mind before you go feral with it.

  • roar_vs_buffer() β€” this is the one that initializes buffered mode. it takes the size of the buffer as its argument. the size should be a power of two, okay? and the common values people actually use are 2048 and 4096 ✨
  • roar_vs_get_avail_read() and roar_vs_get_avail_write() β€” these two return the amount of free space in the read buffer and the write buffer respectively. like a lil vibe check on how much room you got left πŸ‘‘
  • roar_vs_reset_buffer() β€” resets the read and/or write buffer. and what does "reset" mean here, bestie? it means the data in the buffers is discarded πŸ’€ this does NOT happen frame aligned and it may result in broken audio. so like, iconic but also dangerous, your call.
🚨 IMPORTANT: buffers are not flushed automatically. to flush them you gotta use roar_vs_iterate(3) or roar_vs_run(3). don't forget, or you'll be sitting there like "why is nothing happening" πŸ™ˆ

πŸŽ€ PARAMETERS πŸŽ€

  • vss β€” the VS object you're working with. your main character, fr fr.
  • buffer β€” the size of the buffer to be used, in bytes.
  • writering, readring β€” these select which buffer to reset. must be either ROAR_VS_TRUE or ROAR_VS_FALSE. no in-between, no "maybe", periodt.
  • error β€” a pointer to an int where the error value gets stored if something goes wrong. it can be NULL if you're not using it, but honestly it is very recommended to use it so you can report good error messages to the user. be a good citizen 🫢

⭐ RETURN VALUE ⭐

  • on success, these calls return 0. slay.
  • roar_vs_get_avail_read() and roar_vs_get_avail_write() return the free space in the corresponding buffer instead β€” that's their whole thing.
  • on error, -1 is returned. 😭

🌈 EXAMPLES 🌈

FIXME

(yes bestie, the original literally just says FIXME. the docs ate and left no crumbs, apparently πŸ’€)


πŸ‘‘ SEE ALSO πŸ‘‘

roarvs(7), libroar(7), RoarAudio(7).


and that's the whole page, no cap πŸ’– this one came from the RoarAudio manual and it's dated June 2011 β€” so it's been serving buffered-mode realness for a minute 🌸 stay hydrated, flush your buffers, and use roar_vs_iterate(3) or `roar_vs_run(3), mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from