Add API to lookup plugin by URI

This commit is contained in:
Robin Gareus
2025-11-09 16:18:26 +01:00
parent 71ff8ba3e0
commit 8c1bb6ac58
2 changed files with 19 additions and 0 deletions

View File

@@ -251,6 +251,7 @@ public:
}
std::shared_ptr<Processor> processor_by_id (PBD::ID) const;
std::shared_ptr<Processor> plugin_by_uri (std::string const&, int offset = 0) const;
std::shared_ptr<Processor> nth_plugin (uint32_t n) const;
std::shared_ptr<Processor> nth_send (uint32_t n) const;

View File

@@ -5631,6 +5631,24 @@ Route::processor_by_id (PBD::ID id) const
return std::shared_ptr<Processor> ();
}
std::shared_ptr<Processor>
Route::plugin_by_uri (std::string const& uri, int offset) const
{
Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
for (auto const& p : _processors) {
std::shared_ptr<PluginInsert> pi = std::dynamic_pointer_cast<PluginInsert>(p);
if (!pi) {
continue;
}
if (pi->plugin()->unique_id () == uri) {
if (offset-- <= 0) {
return p;
}
}
}
return std::shared_ptr<Processor> ();
}
bool
Route::can_freeze_processor (std::shared_ptr<Processor> p, bool allow_routing) const
{