triggers: add convenience function to report # of trigger channels

This commit is contained in:
Ben Loftis 2022-11-01 08:29:26 -05:00
parent 756e0beb1b
commit 4f5106ae82
2 changed files with 21 additions and 0 deletions

View File

@ -1375,6 +1375,7 @@ public:
void trigger_cue_row (int32_t);
CueEvents const & cue_events() const { return _cue_events; }
int num_triggerboxes () const;
boost::shared_ptr<TriggerBox> triggerbox_at (int32_t route_index) const;
TriggerPtr trigger_at (int32_t route_index, int32_t row_index) const;
bool bang_trigger_at(int32_t route_index, int32_t row_index);

View File

@ -1806,6 +1806,26 @@ Session::triggerbox_at (int32_t route_index) const
return boost::shared_ptr<TriggerBox>();
}
int
Session::num_triggerboxes () const
{
int count = 0;
StripableList sl;
get_stripables (sl);
for (StripableList::iterator s = sl.begin (); s != sl.end (); ++s) {
boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route> (*s);
if (!r || !r->triggerbox ()) {
continue;
}
/* we're only interested in Trigger Tracks */
if (!(r->presentation_info ().trigger_track ())) {
continue;
}
count++;
}
return count;
}
TriggerPtr
Session::trigger_at (int32_t route_index, int32_t trigger_index) const
{