Connect unknown optional LV2 ports to NULL

This commit is contained in:
Daniel Appelt 2024-09-07 17:46:11 +02:00 committed by Robin Gareus
parent 5a1fc0ddc9
commit af8a7df991
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 10 additions and 3 deletions

View file

@ -255,7 +255,8 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
PORT_AUTOCTRL = 1 << 9, ///< Event port supports auto:AutomationControl
PORT_CTRLED = 1 << 10, ///< Port prop auto:AutomationControlled (can be self controlled)
PORT_CTRLER = 1 << 11, ///< Port prop auto:AutomationController (can be self set)
PORT_NOAUTO = 1 << 12 ///< Port don't allow to automate
PORT_NOAUTO = 1 << 12, ///< Port don't allow to automate
PORT_OTHOPT = 1 << 13 ///< Port of unknown data type with prop connectionOptional
} PortFlag;
typedef unsigned PortFlags;

View file

@ -838,7 +838,9 @@ LV2Plugin::init(const void* c_plugin, samplecnt_t rate)
lilv_nodes_free(min_size_v);
lilv_nodes_free(buffer_types);
lilv_nodes_free(atom_supports);
} else if (!lilv_port_has_property(_impl->plugin, port, _world.lv2_connectionOptional)) {
} else if (lilv_port_has_property(_impl->plugin, port, _world.lv2_connectionOptional)) {
flags |= PORT_OTHOPT; // unknown data type but connection optional
} else {
error << string_compose(
"LV2: \"%1\" port %2 has no known data type",
lilv_node_as_string(_impl->name), i) << endmsg;
@ -2994,6 +2996,8 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
}
buf = lv2_evbuf_get_buffer(_ev_buffers[port_index]);
} else if(flags & PORT_OTHOPT) {
// Explicitely connect optional ports that we can not handle to NULL
} else {
continue; // Control port, leave buffer alone
}
@ -3453,6 +3457,8 @@ LV2Plugin::latency_compute_run()
ev_buffers.push_back (lv2_evbuf_new (buf_size, _uri_map.urids.atom_Chunk, _uri_map.urids.atom_Sequence));
void* buf = lv2_evbuf_get_buffer (ev_buffers.back ());
lilv_instance_connect_port(_impl->instance, port_index, buf);
} else if (flags & PORT_OTHOPT) {
lilv_instance_connect_port(_impl->instance, port_index, NULL);
}
}
@ -3974,7 +3980,7 @@ LV2PluginInfo::discover (boost::function <void (std::string const&, PluginScanLo
count_ctrl_out++;
}
}
else if (!lilv_port_is_a(p, port, world.lv2_AudioPort) && !lilv_port_has_property(p, port, world.lv2_connectionOptional)) {
else if (!(lilv_port_is_a(p, port, world.lv2_AudioPort) || lilv_port_has_property(p, port, world.lv2_connectionOptional))) {
err = 1;
LilvNode* name = lilv_port_get_name(p, port);
cb (uri, PluginScanLogEntry::Error, string_compose (_("Port %1 ('%2') has no known data type"), i, lilv_node_as_string (name)), false);