LV2: /home/yano/lv2/lv2-1.18.10-1.x86_64/src/lv2-1.18.10/include/lv2/event/event-helpers.h File Reference

# LV2

An open and extensible audio plugin standard

Version | 1.18.10

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Functions
event-helpers.h File Reference

## 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.

## Data Structures
struct | LV2_Event_Iterator

## Functions
static uint16_t | lv2_event_pad_size (uint16_t size)
static void | lv2_event_buffer_reset (LV2_Event_Buffer *buf, uint16_t stamp_type, uint8_t *data)
static LV2_Event_Buffer * | lv2_event_buffer_new (uint32_t capacity, uint16_t stamp_type)
static bool | lv2_event_begin (LV2_Event_Iterator *iter, LV2_Event_Buffer *buf)
static bool | lv2_event_is_valid (LV2_Event_Iterator *iter)
static bool | lv2_event_increment (LV2_Event_Iterator *iter)
static LV2_Event * | lv2_event_get (LV2_Event_Iterator *iter, uint8_t **data)
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)
static uint8_t * | lv2_event_reserve (LV2_Event_Iterator *iter, uint32_t frames, uint32_t subframes, uint16_t type, uint16_t size)
static bool | lv2_event_write_event (LV2_Event_Iterator *iter, const LV2_Event *ev, const uint8_t *data)

## Data Structure Documentation

## ◆ LV2_Event_Iterator

struct LV2_Event_Iterator

An iterator over an LV2_Event_Buffer.

Multiple simultaneous read iterators over a single buffer is fine, but changing the buffer invalidates all iterators.

Data Fields
LV2_Event_Buffer * | buf |
uint32_t | offset |

## Function Documentation

## ◆ lv2_event_pad_size()

static uint16_t lv2_event_pad_size | ( | uint16_t | size | ) |
| inlinestatic

Pad a size to 64 bits (for event sizes)

## ◆ lv2_event_buffer_reset()

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.

## ◆ lv2_event_buffer_new()

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

Allocate a new, empty event buffer.

## ◆ lv2_event_begin()

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)

## ◆ lv2_event_is_valid()

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)

## ◆ lv2_event_increment()

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)

## ◆ lv2_event_get()

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).

## ◆ lv2_event_write()

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).

## ◆ lv2_event_reserve()

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.

## ◆ lv2_event_write_event()

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).