From b3ade99a587eb39163f7e2640de2f3b3e0580c38 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 24 Nov 2019 21:29:34 +0000 Subject: [PATCH] Fix loading of LV2 effects that have Event ports (Calf Plugins) The Calf plugin suite exposes Event ports which is currently not supported or defined in `liblilv`, so instead of flat rejecting the filter, test the port name for `Events` and allow them to load. --- src/effects/lv2/LV2Effect.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/effects/lv2/LV2Effect.cpp b/src/effects/lv2/LV2Effect.cpp index 2f6303df4..2206f4b6b 100644 --- a/src/effects/lv2/LV2Effect.cpp +++ b/src/effects/lv2/LV2Effect.cpp @@ -432,7 +432,22 @@ bool LV2Effect::SetHost(EffectHostInterface *host) if (!lilv_port_is_a(mPlug, port, gAudio) && !lilv_port_is_a(mPlug, port, gControl)) { - return false; + // There is no event port support in liblilv + // The workaround below tests for an event port, used + // for example in Calf plug-ins. + // We'll allow an event port, even though we won't use it. + // Otherwise we return false and reject the plug in. + + LilvNode* name = lilv_port_get_name(mPlug, port); + if (!name) + return false; + + if (strcmp(lilv_node_as_string(name), "Events") != 0) + { + lilv_node_free(name); + return false; + } + lilv_node_free(name); } }