From 49c05a2653e2f6c8abd8390a5e1f07361cd66f33 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 2 Jun 2009 23:24:28 +0000 Subject: Fix horribly broken LV2 event implementation (ticket #378 among other problems). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2061 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/LV2EventBuffer.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/engine/LV2EventBuffer.cpp') diff --git a/src/engine/LV2EventBuffer.cpp b/src/engine/LV2EventBuffer.cpp index cfd285d4..88b7ad22 100644 --- a/src/engine/LV2EventBuffer.cpp +++ b/src/engine/LV2EventBuffer.cpp @@ -52,10 +52,12 @@ LV2EventBuffer::LV2EventBuffer(size_t capacity) exit(EXIT_FAILURE); } + _data->header_size = sizeof(LV2_Event_Buffer); + _data->data = reinterpret_cast(_data + _data->header_size); + _data->stamp_type = 0; _data->event_count = 0; _data->capacity = (uint32_t)capacity; _data->size = 0; - _data->data = reinterpret_cast(_data + 1); reset(); @@ -188,5 +190,22 @@ LV2EventBuffer::append(const LV2_Event_Buffer* buf) } +/** Clear this buffer and copy @a buf into it. + * The capacity of this buffer must be >= the capacity of @a buf. + */ +void +LV2EventBuffer::copy(const LV2EventBuffer& buf) +{ + assert(buf._data->header_size == _data->header_size); + memcpy(_data, buf._data, _data->header_size + buf._data->size); + + _iter = buf._iter; + _iter.buf = _data; + + _latest_frames = buf._latest_frames; + _latest_subframes = buf._latest_subframes; +} + + } // namespace Ingen -- cgit v1.2.1