summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Makefile.am6
-rw-r--r--test/lv2.cc2
-rw-r--r--test/lv2_test_host.cc21
3 files changed, 25 insertions, 4 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 779e4f4..5aaf33f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -32,8 +32,10 @@ resampler_SOURCES = \
resampler.cc
lv2_CXXFLAGS = -DOUTPUT=\"lv2\" $(CPPUNIT_CFLAGS) \
- -I/usr/include/lilv-0 -I/usr/include/serd-0
-lv2_LDFLAGS = $(CPPUNIT_LIBS) -llilv-0 -lserd-0 -lcrypto
+ `pkg-config --cflags serd-0` `pkg-config --cflags lilv-0` \
+ -DLV2_PATH=\"$(libdir)/lv2\"
+lv2_LDFLAGS = $(CPPUNIT_LIBS) `pkg-config --libs serd-0` \
+ `pkg-config --libs lilv-0` -lcrypto
lv2_SOURCES = \
test.cc \
lv2_test_host.cc \
diff --git a/test/lv2.cc b/test/lv2.cc
index d38aa06..c51d501 100644
--- a/test/lv2.cc
+++ b/test/lv2.cc
@@ -62,7 +62,7 @@ public:
{
int res;
- LV2TestHost h("/home/deva/docs/c/drumgizmo/install/lib/lv2");
+ LV2TestHost h(LV2_PATH);
res = h.open(DG_URI);
CPPUNIT_ASSERT(res == 0);
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;
}