ardour
Classes | Functions
lv2_evbuf.c File Reference
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
#include "lv2/lv2plug.in/ns/ext/event/event.h"
#include "lv2_evbuf.h"

Go to the source code of this file.

Classes

struct  LV2_Evbuf_Impl
 

Functions

static uint32_t lv2_evbuf_pad_size (uint32_t size)
 
LV2_Evbuflv2_evbuf_new (uint32_t capacity, LV2_Evbuf_Type type, uint32_t atom_Chunk, uint32_t atom_Sequence)
 
void lv2_evbuf_free (LV2_Evbuf *evbuf)
 
void lv2_evbuf_set_type (LV2_Evbuf *evbuf, LV2_Evbuf_Type type)
 
void lv2_evbuf_reset (LV2_Evbuf *evbuf, bool input)
 
uint32_t lv2_evbuf_get_size (LV2_Evbuf *evbuf)
 
uint32_t lv2_evbuf_get_capacity (LV2_Evbuf *evbuf)
 
void * lv2_evbuf_get_buffer (LV2_Evbuf *evbuf)
 
LV2_Evbuf_Iterator lv2_evbuf_begin (LV2_Evbuf *evbuf)
 
LV2_Evbuf_Iterator lv2_evbuf_end (LV2_Evbuf *evbuf)
 
bool lv2_evbuf_is_valid (LV2_Evbuf_Iterator iter)
 
LV2_Evbuf_Iterator lv2_evbuf_next (LV2_Evbuf_Iterator iter)
 
bool lv2_evbuf_get (LV2_Evbuf_Iterator iter, uint32_t *frames, uint32_t *subframes, uint32_t *type, uint32_t *size, uint8_t **data)
 
bool lv2_evbuf_write (LV2_Evbuf_Iterator *iter, uint32_t frames, uint32_t subframes, uint32_t type, uint32_t size, const uint8_t *data)
 

Function Documentation

LV2_Evbuf_Iterator lv2_evbuf_begin ( LV2_Evbuf evbuf)

Return an iterator to the start of buf.

Definition at line 137 of file lv2_evbuf.c.

LV2_Evbuf_Iterator lv2_evbuf_end ( LV2_Evbuf evbuf)

Return an iterator to the end of buf.

Definition at line 144 of file lv2_evbuf.c.

void lv2_evbuf_free ( LV2_Evbuf evbuf)

Free an event buffer allocated with lv2_evbuf_new.

Definition at line 61 of file lv2_evbuf.c.

bool lv2_evbuf_get ( LV2_Evbuf_Iterator  iter,
uint32_t *  frames,
uint32_t *  subframes,
uint32_t *  type,
uint32_t *  size,
uint8_t **  data 
)

Dereference an event iterator (i.e. get the event currently pointed to). iter must be valid. type Set to the type of the event. size Set to the size of the event. data Set to the contents of the event.

Returns
True on success.

Definition at line 185 of file lv2_evbuf.c.

void* lv2_evbuf_get_buffer ( LV2_Evbuf evbuf)

Return the actual buffer implementation. The format of the buffer returned depends on the buffer type.

Definition at line 125 of file lv2_evbuf.c.

uint32_t lv2_evbuf_get_capacity ( LV2_Evbuf evbuf)

Return the available capacity of the buffer

Definition at line 119 of file lv2_evbuf.c.

uint32_t lv2_evbuf_get_size ( LV2_Evbuf evbuf)

Return the total padded size of the events stored in the buffer.

Definition at line 103 of file lv2_evbuf.c.

bool lv2_evbuf_is_valid ( LV2_Evbuf_Iterator  iter)

Check if iter is valid.

Returns
True if iter is valid, otherwise false (past end of buffer)

Definition at line 152 of file lv2_evbuf.c.

LV2_Evbuf* lv2_evbuf_new ( uint32_t  capacity,
LV2_Evbuf_Type  type,
uint32_t  atom_Chunk,
uint32_t  atom_Sequence 
)

Allocate a new, empty event buffer. URIDs for atom:Chunk and atom:Sequence must be passed for LV2_EVBUF_ATOM.

Definition at line 44 of file lv2_evbuf.c.

LV2_Evbuf_Iterator lv2_evbuf_next ( LV2_Evbuf_Iterator  iter)

Advance iter forward one event. iter must be valid.

Returns
True if iter is valid, otherwise false (reached end of buffer)

Definition at line 158 of file lv2_evbuf.c.

static uint32_t lv2_evbuf_pad_size ( uint32_t  size)
inlinestatic

Definition at line 38 of file lv2_evbuf.c.

void lv2_evbuf_reset ( LV2_Evbuf evbuf,
bool  input 
)

Clear and initialize an existing event buffer. The contents of buf are ignored entirely and overwritten, except capacity which is unmodified. If input is false and this is an atom buffer, the buffer will be prepared for writing by the plugin. This MUST be called before every run cycle.

Definition at line 82 of file lv2_evbuf.c.

void lv2_evbuf_set_type ( LV2_Evbuf evbuf,
LV2_Evbuf_Type  type 
)

Reset and change the type of an existing event buffer. URIDs for atom:Chunk and atom:Sequence must be passed for LV2_EVBUF_ATOM.

Definition at line 67 of file lv2_evbuf.c.

bool lv2_evbuf_write ( LV2_Evbuf_Iterator iter,
uint32_t  frames,
uint32_t  subframes,
uint32_t  type,
uint32_t  size,
const uint8_t *  data 
)

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

Definition at line 230 of file lv2_evbuf.c.