Session::trigger_by_id finds a trigger from its pbd::id

This commit is contained in:
Ben Loftis 2022-01-27 12:40:01 -06:00
parent 4e1606e0f0
commit 63e134097c
2 changed files with 20 additions and 0 deletions

View File

@ -90,6 +90,7 @@
#include "ardour/route.h"
#include "ardour/route_graph.h"
#include "ardour/transport_api.h"
#include "ardour/triggerbox.h"
class XMLTree;
class XMLNode;
@ -1195,6 +1196,8 @@ public:
/* Controllables */
boost::shared_ptr<ARDOUR::Trigger> trigger_by_id (PBD::ID) const;
boost::shared_ptr<Processor> processor_by_id (PBD::ID) const;
boost::shared_ptr<PBD::Controllable> controllable_by_id (const PBD::ID&);

View File

@ -4125,6 +4125,23 @@ Session::stripable_by_id (PBD::ID id) const
return boost::shared_ptr<Stripable>();
}
boost::shared_ptr<Trigger>
Session::trigger_by_id (PBD::ID id) const
{
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
boost::shared_ptr<TriggerBox> box = (*i)->triggerbox();
if (box) {
TriggerPtr trigger = box->trigger_by_id(id);
if (trigger) {
return trigger;
}
}
}
return boost::shared_ptr<Trigger> ();
}
boost::shared_ptr<Processor>
Session::processor_by_id (PBD::ID id) const
{