summaryrefslogtreecommitdiffstats
path: root/src/server/BlockFactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/BlockFactory.cpp')
-rw-r--r--src/server/BlockFactory.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp
index 4c8dd1d7..124a0f61 100644
--- a/src/server/BlockFactory.cpp
+++ b/src/server/BlockFactory.cpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2015 David Robillard <http://drobilla.net/>
+ Copyright 2007-2024 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -148,8 +148,10 @@ BlockFactory::load_lv2_plugins()
// Build an array of port type nodes for checking compatibility
using Types = std::vector<std::shared_ptr<LilvNode>>;
Types types;
- for (unsigned t = PortType::ID::AUDIO; t <= PortType::ID::ATOM; ++t) {
- const URI uri{PortType(static_cast<PortType::ID>(t)).uri()};
+ for (auto t = static_cast<unsigned>(PortType::AUDIO);
+ t <= static_cast<unsigned>(PortType::ATOM);
+ ++t) {
+ const URI uri = port_type_uri(static_cast<PortType>(t));
types.push_back(std::shared_ptr<LilvNode>(
lilv_new_uri(_world.lilv_world(), uri.c_str()), lilv_node_free));
}
@@ -186,13 +188,13 @@ BlockFactory::load_lv2_plugins()
const uint32_t n_ports = lilv_plugin_get_num_ports(lv2_plug);
for (uint32_t p = 0; p < n_ports; ++p) {
const LilvPort* port = lilv_plugin_get_port_by_index(lv2_plug, p);
- supported = false;
- for (const auto& t : types) {
- if (lilv_port_is_a(lv2_plug, port, t.get())) {
- supported = true;
- break;
- }
- }
+ supported =
+ std::any_of(types.begin(),
+ types.end(),
+ [&lv2_plug, &port](const auto& t) {
+ return lilv_port_is_a(lv2_plug, port, t.get());
+ });
+
if (!supported &&
!lilv_port_has_property(lv2_plug,
port,