basic_ui: add convenience functions to access an NxM bank of triggers
This commit is contained in:
parent
4f5106ae82
commit
0851d230cd
|
@ -44,7 +44,9 @@ using namespace Temporal;
|
||||||
PBD::Signal2<void,std::string,std::string> BasicUI::AccessAction;
|
PBD::Signal2<void,std::string,std::string> BasicUI::AccessAction;
|
||||||
|
|
||||||
BasicUI::BasicUI (Session& s)
|
BasicUI::BasicUI (Session& s)
|
||||||
: session (&s)
|
: session (&s),
|
||||||
|
_tbank_start_route (0),
|
||||||
|
_tbank_start_row (0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,6 +443,24 @@ BasicUI::trigger_cue_row (int cue_idx)
|
||||||
session->trigger_cue_row (cue_idx);
|
session->trigger_cue_row (cue_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BasicUI::tbank_step_route (int step_size)
|
||||||
|
{
|
||||||
|
_tbank_start_route += step_size;
|
||||||
|
if (_tbank_start_route < 0) {
|
||||||
|
_tbank_start_route=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BasicUI::tbank_step_row (int step_size)
|
||||||
|
{
|
||||||
|
_tbank_start_row += step_size;
|
||||||
|
if (_tbank_start_row < 0) {
|
||||||
|
_tbank_start_row=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BasicUI::undo ()
|
BasicUI::undo ()
|
||||||
{
|
{
|
||||||
|
@ -804,16 +824,49 @@ BasicUI::find_trigger (int x, int y)
|
||||||
return tp;
|
return tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
BasicUI::trigger_progress_at (int x)
|
||||||
|
{
|
||||||
|
boost::shared_ptr<TriggerBox> tb = session->triggerbox_at (_tbank_start_route + x);
|
||||||
|
if (tb) {
|
||||||
|
ARDOUR::TriggerPtr trigger = tb->currently_playing ();
|
||||||
|
if (trigger) {
|
||||||
|
return trigger->position_as_fraction ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
BasicUI::TriggerDisplay
|
||||||
|
BasicUI::trigger_display_at (int x, int y)
|
||||||
|
{
|
||||||
|
TriggerDisplay disp;
|
||||||
|
|
||||||
|
boost::shared_ptr<TriggerBox> tb = session->triggerbox_at (_tbank_start_route + x);
|
||||||
|
if (tb) {
|
||||||
|
ARDOUR::TriggerPtr current = tb->currently_playing ();
|
||||||
|
TriggerPtr tp = tb->trigger (_tbank_start_row + y);
|
||||||
|
if (tp) {
|
||||||
|
if (!tp->region()) {
|
||||||
|
disp.state = -1;
|
||||||
|
} else if (tp == current) {
|
||||||
|
disp.state = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return disp;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BasicUI::bang_trigger_at (int x, int y)
|
BasicUI::bang_trigger_at (int x, int y)
|
||||||
{
|
{
|
||||||
session->bang_trigger_at (x, y);
|
session->bang_trigger_at (_tbank_start_route + x, _tbank_start_row + y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BasicUI::unbang_trigger_at (int x, int y)
|
BasicUI::unbang_trigger_at (int x, int y)
|
||||||
{
|
{
|
||||||
session->unbang_trigger_at (x, y);
|
session->unbang_trigger_at (_tbank_start_route + x, _tbank_start_row + y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -167,6 +167,24 @@ class LIBCONTROLCP_API BasicUI {
|
||||||
bool rewind_button_onoff() const;
|
bool rewind_button_onoff() const;
|
||||||
bool loop_button_onoff() const;
|
bool loop_button_onoff() const;
|
||||||
|
|
||||||
|
/* These functions access Triggers in the order they are displayed on the Cue page, WITH an optional bank offset
|
||||||
|
Use this for a launchpad-style NxM (route x row) matrix that maps directly to the Cue page layout.
|
||||||
|
Trigger banking is separate from 'route' banking implemented by a fader surface.
|
||||||
|
To match a fader/mute/solo to the Trigger banking, the tentative plan is:
|
||||||
|
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);
|
||||||
|
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 */
|
||||||
|
//potentially name, color, launch style, follow action(s) etc
|
||||||
|
}
|
||||||
|
};
|
||||||
|
TriggerDisplay trigger_display_at (int x, int y);
|
||||||
void bang_trigger_at (int x, int y);
|
void bang_trigger_at (int x, int y);
|
||||||
void unbang_trigger_at (int x, int y);
|
void unbang_trigger_at (int x, int y);
|
||||||
|
|
||||||
|
@ -176,6 +194,8 @@ class LIBCONTROLCP_API BasicUI {
|
||||||
protected:
|
protected:
|
||||||
BasicUI ();
|
BasicUI ();
|
||||||
ARDOUR::Session* session;
|
ARDOUR::Session* session;
|
||||||
|
|
||||||
|
int _tbank_start_route, _tbank_start_row;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __ardour_basic_ui_h__ */
|
#endif /* __ardour_basic_ui_h__ */
|
||||||
|
|
Loading…
Reference in New Issue