LV2  1.0.13
Data Structures | Functions
event-helpers.h File Reference

Helper functions for the LV2 Event extension http://lv2plug.in/ns/ext/event. More...

Data Structures

struct  LV2_Event_Iterator
 An iterator over an LV2_Event_Buffer. More...

Functions

static uint16_t lv2_event_pad_size (uint16_t size)
 Pad a size to 64 bits (for event sizes)
static void lv2_event_buffer_reset (LV2_Event_Buffer *buf, uint16_t stamp_type, uint8_t *data)
 Initialize (empty, reset..) an existing event buffer.
static LV2_Event_Bufferlv2_event_buffer_new (uint32_t capacity, uint16_t stamp_type)
 Allocate a new, empty event buffer.
static bool lv2_event_begin (LV2_Event_Iterator *iter, LV2_Event_Buffer *buf)
 Reset an iterator to point to the start of buf.
static bool lv2_event_is_valid (LV2_Event_Iterator *iter)
 Check if iter is valid.
static bool lv2_event_increment (LV2_Event_Iterator *iter)
 Advance iter forward one event.
static LV2_Eventlv2_event_get (LV2_Event_Iterator *iter, uint8_t **data)
 Dereference an event iterator (get the event currently pointed at).
static bool lv2_event_write (LV2_Event_Iterator *iter, uint32_t frames, uint32_t subframes, uint16_t type, uint16_t size, const uint8_t *data)
 Write an event at iter.
static uint8_t * lv2_event_reserve (LV2_Event_Iterator *iter, uint32_t frames, uint32_t subframes, uint16_t type, uint16_t size)
 Reserve space for an event in the buffer and return a pointer to the memory where the caller can write the event data, or NULL if there is not enough room in the buffer.
static bool lv2_event_write_event (LV2_Event_Iterator *iter, const LV2_Event *ev, const uint8_t *data)
 Write an event at iter.

Detailed Description

Helper functions for the LV2 Event extension http://lv2plug.in/ns/ext/event.

These functions are provided for convenience only, use of them is not required for supporting lv2ev (i.e. the events extension is defined by the raw buffer format described in lv2_event.h and NOT by this API).

Note that these functions are all static inline which basically means: do not take the address of these functions.

Function Documentation

static uint16_t lv2_event_pad_size ( uint16_t  size)
inlinestatic

Pad a size to 64 bits (for event sizes)

static void lv2_event_buffer_reset ( LV2_Event_Buffer buf,
uint16_t  stamp_type,
uint8_t *  data 
)
inlinestatic

Initialize (empty, reset..) an existing event buffer.

The contents of buf are ignored entirely and overwritten, except capacity which is unmodified.

static LV2_Event_Buffer* lv2_event_buffer_new ( uint32_t  capacity,
uint16_t  stamp_type 
)
inlinestatic

Allocate a new, empty event buffer.

static bool lv2_event_begin ( LV2_Event_Iterator iter,
LV2_Event_Buffer buf 
)
inlinestatic

Reset an iterator to point to the start of buf.

Returns
True if iter is valid, otherwise false (buffer is empty)
static bool lv2_event_is_valid ( LV2_Event_Iterator iter)
inlinestatic

Check if iter is valid.

Returns
True if iter is valid, otherwise false (past end of buffer)
static bool lv2_event_increment ( LV2_Event_Iterator iter)
inlinestatic

Advance iter forward one event.

iter must be valid.

Returns
True if iter is valid, otherwise false (reached end of buffer)
static LV2_Event* lv2_event_get ( LV2_Event_Iterator iter,
uint8_t **  data 
)
inlinestatic

Dereference an event iterator (get the event currently pointed at).

iter must be valid. data if non-NULL, will be set to point to the contents of the event returned.

Returns
A Pointer to the event iter is currently pointing at, or NULL if the end of the buffer is reached (in which case data is also set to NULL).
static bool lv2_event_write ( LV2_Event_Iterator iter,
uint32_t  frames,
uint32_t  subframes,
uint16_t  type,
uint16_t  size,
const uint8_t *  data 
)
inlinestatic

Write an event at iter.

The event (if any) pointed to by iter will be overwritten, and iter incremented to point to the following event (i.e. several calls to this function can be done in sequence without twiddling iter in-between).

Returns
True if event was written, otherwise false (buffer is full).
static uint8_t* lv2_event_reserve ( LV2_Event_Iterator iter,
uint32_t  frames,
uint32_t  subframes,
uint16_t  type,
uint16_t  size 
)
inlinestatic

Reserve space for an event in the buffer and return a pointer to the memory where the caller can write the event data, or NULL if there is not enough room in the buffer.

static bool lv2_event_write_event ( LV2_Event_Iterator iter,
const LV2_Event ev,
const uint8_t *  data 
)
inlinestatic

Write an event at iter.

The event (if any) pointed to by iter will be overwritten, and iter incremented to point to the following event (i.e. several calls to this function can be done in sequence without twiddling iter in-between).

Returns
True if event was written, otherwise false (buffer is full).