return 0;
}
+uint32_t
+lv2_evbuf_get_capacity(LV2_Evbuf* evbuf)
+{
+ return evbuf->capacity;
+}
+
void*
lv2_evbuf_get_buffer(LV2_Evbuf* evbuf)
{
uint32_t size;
switch (evbuf->type) {
case LV2_EVBUF_EVENT:
- size = ((LV2_Event*)(evbuf->buf.event.data + offset))->size;
+ size = ((LV2_Event*)((uintptr_t)(evbuf->buf.event.data + offset)))->size;
offset += lv2_evbuf_pad_size(sizeof(LV2_Event) + size);
break;
case LV2_EVBUF_ATOM:
- size = ((LV2_Atom_Event*)
+ size = ((LV2_Atom_Event*)((uintptr_t)
((char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, &evbuf->buf.atom)
- + offset))->body.size;
+ + offset)))->body.size;
offset += lv2_evbuf_pad_size(sizeof(LV2_Atom_Event) + size);
break;
}
bool
lv2_evbuf_get(LV2_Evbuf_Iterator iter,
- uint32_t* frames,
+ uint32_t* samples,
uint32_t* subframes,
uint32_t* type,
uint32_t* size,
uint8_t** data)
{
- *frames = *subframes = *type = *size = 0;
+ *samples = *subframes = *type = *size = 0;
*data = NULL;
if (!lv2_evbuf_is_valid(iter)) {
switch (iter.evbuf->type) {
case LV2_EVBUF_EVENT:
ebuf = &iter.evbuf->buf.event;
- ev = (LV2_Event*)ebuf->data + iter.offset;
- *frames = ev->frames;
+ ev = (LV2_Event*)((uintptr_t)((char*)ebuf->data + iter.offset));
+ *samples = ev->frames;
*subframes = ev->subframes;
*type = ev->type;
*size = ev->size;
break;
case LV2_EVBUF_ATOM:
aseq = (LV2_Atom_Sequence*)&iter.evbuf->buf.atom;
- aev = (LV2_Atom_Event*)(
+ aev = (LV2_Atom_Event*)((uintptr_t)(
(char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, aseq)
- + iter.offset);
- *frames = aev->time.frames;
+ + iter.offset));
+ *samples = aev->time.frames;
*subframes = 0;
*type = aev->body.type;
*size = aev->body.size;
- *data = LV2_ATOM_BODY(&aev->body);
+ *data = (uint8_t*)LV2_ATOM_BODY(&aev->body);
break;
}
bool
lv2_evbuf_write(LV2_Evbuf_Iterator* iter,
- uint32_t frames,
+ uint32_t samples,
uint32_t subframes,
uint32_t type,
uint32_t size,
return false;
}
- ev = (LV2_Event*)(ebuf->data + iter->offset);
- ev->frames = frames;
+ ev = (LV2_Event*)((uintptr_t)(ebuf->data + iter->offset));
+ ev->frames = samples;
ev->subframes = subframes;
ev->type = type;
ev->size = size;
return false;
}
- aev = (LV2_Atom_Event*)(
+ aev = (LV2_Atom_Event*)((uintptr_t)(
(char*)LV2_ATOM_CONTENTS(LV2_Atom_Sequence, aseq)
- + iter->offset);
- aev->time.frames = frames;
+ + iter->offset));
+ aev->time.frames = samples;
aev->body.type = type;
aev->body.size = size;
memcpy(LV2_ATOM_BODY(&aev->body), data, size);