21 #include "lv2/lv2plug.in/ns/ext/atom/atom.h"
22 #include "lv2/lv2plug.in/ns/ext/event/event.h"
37 static inline uint32_t
40 return (size + 7) & (~7);
47 uint32_t atom_Sequence)
51 sizeof(
LV2_Evbuf) +
sizeof(LV2_Atom_Sequence) + capacity);
72 evbuf->
buf.
event.data = (uint8_t*)(evbuf + 1);
84 switch (evbuf->
type) {
86 evbuf->
buf.
event.header_size =
sizeof(LV2_Event_Buffer);
87 evbuf->
buf.
event.stamp_type = LV2_EVENT_AUDIO_STAMP;
93 evbuf->
buf.
atom.atom.size =
sizeof(LV2_Atom_Sequence_Body);
105 switch (evbuf->
type) {
110 || evbuf->
buf.
atom.atom.size >=
sizeof(LV2_Atom_Sequence_Body));
112 ? evbuf->
buf.
atom.atom.size -
sizeof(LV2_Atom_Sequence_Body)
127 switch (evbuf->
type) {
165 uint32_t offset = iter.
offset;
167 switch (evbuf->
type) {
169 size = ((LV2_Event*)((uintptr_t)(evbuf->
buf.
event.data + offset)))->size;
173 size = ((LV2_Atom_Event*)((uintptr_t)
174 ((
char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, &evbuf->
buf.
atom)
175 + offset)))->body.size;
192 *frames = *subframes = *type = *size = 0;
199 LV2_Event_Buffer* ebuf;
201 LV2_Atom_Sequence* aseq;
206 ev = (LV2_Event*)((uintptr_t)((
char*)ebuf->data + iter.
offset));
207 *frames = ev->frames;
208 *subframes = ev->subframes;
211 *data = (uint8_t*)ev +
sizeof(LV2_Event);
215 aev = (LV2_Atom_Event*)((uintptr_t)(
216 (
char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, aseq)
218 *frames = aev->time.frames;
220 *type = aev->body.type;
221 *size = aev->body.size;
222 *data = (uint8_t*)LV2_ATOM_BODY(&aev->body);
237 LV2_Event_Buffer* ebuf;
239 LV2_Atom_Sequence* aseq;
244 if (ebuf->capacity - ebuf->size <
sizeof(LV2_Event) + size) {
248 ev = (LV2_Event*)((uintptr_t)(ebuf->data + iter->
offset));
250 ev->subframes = subframes;
253 memcpy((uint8_t*)ev +
sizeof(LV2_Event), data, size);
257 ebuf->event_count += 1;
262 if (iter->
evbuf->
capacity -
sizeof(LV2_Atom) - aseq->atom.size
263 <
sizeof(LV2_Atom_Event) + size) {
267 aev = (LV2_Atom_Event*)((uintptr_t)(
268 (
char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, aseq)
270 aev->time.frames = frames;
271 aev->body.type = type;
272 aev->body.size = size;
273 memcpy(LV2_ATOM_BODY(&aev->body), data, size);
276 aseq->atom.size += size;
bool lv2_evbuf_is_valid(LV2_Evbuf_Iterator iter)
LV2_Evbuf_Iterator lv2_evbuf_begin(LV2_Evbuf *evbuf)
LV2_Evbuf_Iterator lv2_evbuf_end(LV2_Evbuf *evbuf)
static uint32_t lv2_evbuf_pad_size(uint32_t size)
union LV2_Evbuf_Impl::@16 buf
void lv2_evbuf_set_type(LV2_Evbuf *evbuf, LV2_Evbuf_Type type)
void * lv2_evbuf_get_buffer(LV2_Evbuf *evbuf)
bool lv2_evbuf_get(LV2_Evbuf_Iterator iter, uint32_t *frames, uint32_t *subframes, uint32_t *type, uint32_t *size, uint8_t **data)
LV2_Evbuf_Iterator lv2_evbuf_next(LV2_Evbuf_Iterator iter)
bool lv2_evbuf_write(LV2_Evbuf_Iterator *iter, uint32_t frames, uint32_t subframes, uint32_t type, uint32_t size, const uint8_t *data)
LV2_Evbuf * lv2_evbuf_new(uint32_t capacity, LV2_Evbuf_Type type, uint32_t atom_Chunk, uint32_t atom_Sequence)
uint32_t lv2_evbuf_get_capacity(LV2_Evbuf *evbuf)
uint32_t lv2_evbuf_get_size(LV2_Evbuf *evbuf)
void lv2_evbuf_free(LV2_Evbuf *evbuf)
void lv2_evbuf_reset(LV2_Evbuf *evbuf, bool input)