summaryrefslogtreecommitdiffstats
path: root/src/engine/LV2EventBuffer.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-06-02 23:24:28 +0000
committerDavid Robillard <d@drobilla.net>2009-06-02 23:24:28 +0000
commit49c05a2653e2f6c8abd8390a5e1f07361cd66f33 (patch)
tree487210029e9367fee2d5c88c7ea3ecb1ac33bd12 /src/engine/LV2EventBuffer.cpp
parenta9f1f6912fa3e6b485a5c6e4195233ef3fb087a1 (diff)
downloadingen-49c05a2653e2f6c8abd8390a5e1f07361cd66f33.tar.gz
ingen-49c05a2653e2f6c8abd8390a5e1f07361cd66f33.tar.bz2
ingen-49c05a2653e2f6c8abd8390a5e1f07361cd66f33.zip
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
Diffstat (limited to 'src/engine/LV2EventBuffer.cpp')
-rw-r--r--src/engine/LV2EventBuffer.cpp21
1 files changed, 20 insertions, 1 deletions
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<uint8_t*>(_data + _data->header_size);
+ _data->stamp_type = 0;
_data->event_count = 0;
_data->capacity = (uint32_t)capacity;
_data->size = 0;
- _data->data = reinterpret_cast<uint8_t*>(_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