summaryrefslogtreecommitdiff
path: root/test/lv2_test_host.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-02-15 17:26:42 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2015-02-15 17:26:42 +0100
commitd55367b36d77e3fde7303bc17585a54e26f8b017 (patch)
treef724d357254bb340be65f08018d4cdc7630aae30 /test/lv2_test_host.cc
parent40bbb48e65efc36cb2ca42b51c7e643203f16c85 (diff)
Make lv2 unittest work with < lv2-1.10. Make LV2_PATH same as lv2 plugin installdir. Use pkg-config for lilv and serd dependencies.
Diffstat (limited to 'test/lv2_test_host.cc')
-rw-r--r--test/lv2_test_host.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/lv2_test_host.cc b/test/lv2_test_host.cc
index 5f10c6b..a6252b6 100644
--- a/test/lv2_test_host.cc
+++ b/test/lv2_test_host.cc
@@ -156,6 +156,25 @@ void LV2TestHost::Sequence::clear()
lv2_atom_sequence_clear(seq);
}
+// Keep this to support atom extension from lv2 < 1.10
+static inline LV2_Atom_Event*
+_lv2_atom_sequence_append_event(LV2_Atom_Sequence* seq,
+ uint32_t capacity,
+ const LV2_Atom_Event* event)
+{
+ const uint32_t total_size = (uint32_t)sizeof(*event) + event->body.size;
+ if (capacity - seq->atom.size < total_size) {
+ return NULL;
+ }
+
+ LV2_Atom_Event* e = lv2_atom_sequence_end(&seq->body, seq->atom.size);
+ memcpy(e, event, total_size);
+
+ seq->atom.size += lv2_atom_pad_size(total_size);
+
+ return e;
+}
+
void LV2TestHost::Sequence::addMidiNote(uint64_t pos,
uint8_t key, int8_t velocity)
{
@@ -176,7 +195,7 @@ void LV2TestHost::Sequence::addMidiNote(uint64_t pos,
ev.msg[2] = velocity;
LV2_Atom_Event *e =
- lv2_atom_sequence_append_event(seq, this->buffer_size, &ev.event);
+ _lv2_atom_sequence_append_event(seq, this->buffer_size, &ev.event);
(void)e;
}