13
0

triggerbox: publish some trigger functions to ::session (for the convenience of control surfaces)

Grid controllers will largely want to access clips in the order they appear on the Cue page

It is up to the device (and/or its ControlProtocol) to handle banking
This commit is contained in:
Ben Loftis 2022-10-01 07:38:58 -05:00
parent 07f47ff6a5
commit 2829f4385f
2 changed files with 56 additions and 0 deletions

View File

@ -1374,6 +1374,9 @@ public:
void trigger_cue_row (int32_t);
CueEvents const & cue_events() const { return _cue_events; }
bool bang_trigger_at(int32_t route_index, int32_t row_index);
bool unbang_trigger_at(int32_t route_index, int32_t row_index);
protected:
friend class AudioEngine;
void set_block_size (pframes_t nframes);

View File

@ -1727,6 +1727,59 @@ Session::trigger_cue_row (int32_t cue)
request_transport_speed (1.0);
}
bool
Session::bang_trigger_at (int32_t route_index, int32_t row_index)
{
/* this is a convenience function for simple control surfaces to bang a trigger without any regards to banking */
int index = 0;
StripableList sl;
get_stripables (sl);
sl.sort (Stripable::Sorter ());
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;
}
if (index == route_index) {
r->triggerbox()->bang_trigger_at(row_index);
return 1;
}
index++;
}
}
bool
Session::unbang_trigger_at (int32_t route_index, int32_t row_index)
{
/* this is a convenience function for simple control surfaces to un-bang a trigger without any regards to banking */
int index = 0;
StripableList sl;
get_stripables (sl);
sl.sort (Stripable::Sorter ());
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;
}
if (index == route_index) {
r->triggerbox()->unbang_trigger_at(row_index);
return 1;
}
index++;
}
}
void
Session::maybe_find_pending_cue ()
{