13
0

triggers: implement grid banking in BasicUI so it can be shared (?)

This commit is contained in:
Ben Loftis 2022-11-01 13:50:14 -05:00
parent 0851d230cd
commit bdf9cedb0e
2 changed files with 24 additions and 5 deletions

View File

@ -45,6 +45,8 @@ PBD::Signal2<void,std::string,std::string> BasicUI::AccessAction;
BasicUI::BasicUI (Session& s)
: session (&s),
_tbank_route_width (8),
_tbank_row_height (8),
_tbank_start_route (0),
_tbank_start_row (0)
{
@ -444,18 +446,31 @@ BasicUI::trigger_cue_row (int cue_idx)
}
void
BasicUI::tbank_step_route (int step_size)
BasicUI::tbank_set_size (int width, int height)
{
_tbank_route_width = width;
_tbank_row_height = height;
}
void
BasicUI::tbank_step_routes (int step_size)
{
_tbank_start_route += step_size;
if (_tbank_start_route + _tbank_route_width > session->num_triggerboxes() ) {
_tbank_start_route=session->num_triggerboxes() - _tbank_route_width;
}
if (_tbank_start_route < 0) {
_tbank_start_route=0;
}
}
void
BasicUI::tbank_step_row (int step_size)
BasicUI::tbank_step_rows (int step_size)
{
_tbank_start_row += step_size;
if (_tbank_start_row + _tbank_row_height > TriggerBox::default_triggers_per_box ) {
_tbank_start_row=TriggerBox::default_triggers_per_box - _tbank_row_height;
}
if (_tbank_start_row < 0) {
_tbank_start_row=0;
}
@ -851,6 +866,8 @@ BasicUI::trigger_display_at (int x, int y)
disp.state = -1;
} else if (tp == current) {
disp.state = 1;
} else {
disp.state = 0;
}
}
}

View File

@ -174,13 +174,14 @@ class LIBCONTROLCP_API BasicUI {
request trigger-tracks-only to be displayed on the surface
bank the faders using the offset reported here
*/
void tbank_step_route (int step_size);
void tbank_step_row (int step_size);
void tbank_set_size (int route_width, int row_height);
void tbank_step_routes (int step_size);
void tbank_step_rows (int step_size);
float trigger_progress_at (int x); /* 0..1 or -1 for not playing; */
struct TriggerDisplay {
int state;
TriggerDisplay () {
state = 0; /* -1=empty; 0=stopped; 1=playing */ /*potentially extend to include */
state = -1; /* -1=empty; 0=stopped; 1=playing */ /*potentially extend to include */
//potentially name, color, launch style, follow action(s) etc
}
};
@ -195,6 +196,7 @@ class LIBCONTROLCP_API BasicUI {
BasicUI ();
ARDOUR::Session* session;
int _tbank_route_width, _tbank_row_height;
int _tbank_start_route, _tbank_start_row;
};