AuScanEvents(3)

✨ AuScanEvents ✨ (from the audiolib library functions manual, bestie)

okay so picture this: you're drowning in audio events and you just want the ONE that matches your vibe check. that's AuScanEvents. she returns the first event that satisfies the predicate. periodt. πŸŽ€


🌸 SYNOPSIS 🌸

#include <audio/audiolib.h>

AuBool AuScanEvents(server, mode, dequeue, predicate, arg, event)
    AuServer *server;
    int mode;
    AuBool dequeue;
    AuBool (*predicate)(AuServer *,AuEvent *, AuPointer);
    AuPointer arg;
    AuEvent *event; /* RETURN */

πŸ¦‹ ARGUMENTS πŸ¦‹

  • server β€” the connection to the audio server. your whole lil link to the audio world fr fr.
  • mode β€” how far she's allowed to look for a match πŸ‘€. this needs to be one of these constants: AuEventsQueuedAlready, AuEventsQueuedAfterReading, or AuEventsQueuedAfterFlush.
  • dequeue β€” if a matching event gets found, should it be yeeted out of the queue? that's what this decides.
  • predicate β€” the procedure that gets called to figure out if an event matches the criteria. this is the vibe check, literally.
  • arg β€” any extra arguments you wanna pass along to the predicate procedure. lil care package for your callback πŸ’Œ
  • event β€” returns the matching event if one gets found. the main character reveal πŸ‘‘

πŸ’– DESCRIPTION πŸ’–

AuScanEvents scans the event queue looking for the first event that satisfies the caller-supplied predicate. she's on a mission and she will not be distracted.

here's the mode breakdown, bestie, listen up:

  • if mode is AuEventsQueuedAlready, AuScanEvents only checks for events already in the queue. no extra effort, no reaching, she's just looking at what's right there πŸ’…
  • if mode is AuEventsQueuedAfterReading, and a matching event isn't found already in the queue, AuScanEvents attempts to read more events out of the application's connection. like okay, she'll go look a lil further for you 🫢
  • if mode is AuEventsQueuedAfterFlush and a matching event isn't already in the queue or isn't waiting to be read, AuScanEvents flushes the output queue and attempts to read more events out of the application's connection. she's doing the MOST and honestly? iconic.

and then: if dequeue is AuTrue, and a matching event is found, it is removed from the queue. gone. bye. not your problem anymore ✨

the predicate procedure is called with the arguments server, event, and arg and should return AuTrue to indicate a match. so like, AuTrue = "yes bestie this is the one", anything else = "not it, keep scrolling" 😭


πŸ‘€ SEE ALSO πŸ‘€

  • AuEventsQueued
  • AuScanForTypedEvent
  • AuNextEvent
  • audiolib β€” Network Audio System C Language Interface

and that's the whole page, no cap!! this beauty lives in the audiolib - event handling docs, version 1.9.4, dated for AuScanEvents(3). go forth and scan those events, you absolute legend πŸ§šπŸ’œ

πŸ“¦ where this page comes from