13
0

US2400: allow selecting the master bus. LED does not respond, though :(

This commit is contained in:
Ben Loftis 2017-10-17 13:27:08 -05:00
parent 48c520a4ef
commit ee09ae1c6b
9 changed files with 45 additions and 6 deletions

View File

@ -77,6 +77,7 @@ Button::name_to_id (const std::string& name)
if (!g_ascii_strcasecmp (name.c_str(), "Bank Left")) { return Left; }
if (!g_ascii_strcasecmp (name.c_str(), "Bank Right")) { return Right; }
if (!g_ascii_strcasecmp (name.c_str(), "Flip")) { return Flip; }
if (!g_ascii_strcasecmp (name.c_str(), "Mstr Select")) { return MstrSelect; }
if (!g_ascii_strcasecmp (name.c_str(), "F1")) { return F1; }
if (!g_ascii_strcasecmp (name.c_str(), "F2")) { return F2; }
if (!g_ascii_strcasecmp (name.c_str(), "F3")) { return F3; }
@ -115,6 +116,7 @@ Button::id_to_name (Button::ID id)
if (id == Left) { return "Bank Left"; }
if (id == Right) { return "Bank Right"; }
if (id == Flip) { return "Flip"; }
if (id == MstrSelect) { return "Mstr Select"; }
if (id == F1) { return "F1"; }
if (id == F2) { return "F2"; }
if (id == F3) { return "F3"; }

View File

@ -57,6 +57,7 @@ public:
Left,
Right,
Flip,
MstrSelect,
FinalGlobalButton,

View File

@ -121,6 +121,8 @@ DeviceInfo::shared_buttons ()
_global_buttons[Button::Flip] = GlobalButtonInfo ("Flip", "assignment", 0x32);
_global_buttons[Button::MstrSelect] = GlobalButtonInfo ("Mstr Select", "assignment", 0x48);
_global_buttons[Button::F1] = GlobalButtonInfo ("F1", "function select", 0x36);
_global_buttons[Button::F2] = GlobalButtonInfo ("F2", "function select", 0x37);
_global_buttons[Button::F3] = GlobalButtonInfo ("F3", "function select", 0x38);

View File

@ -43,7 +43,7 @@ public:
: Control (id, name, group)
, state (off)
, last_state (off)
, llast_state (off)
, llast_state (on)
{
}

View File

@ -769,6 +769,21 @@ US2400Protocol::flip_release (Button &)
{
return none;
}
LedState
US2400Protocol::mstr_press (Button &)
{
// access_action("Mixer/select-none");
SetStripableSelection( session->master_out() );
return on;
}
LedState
US2400Protocol::mstr_release (Button &)
{
return none;
}
LedState
US2400Protocol::name_value_press (Button &)
{

View File

@ -821,7 +821,7 @@ Strip::setup_trackview_vpot (boost::shared_ptr<Stripable> r)
//EQ
int eq_band = -1;
if (r->mixbus ()) {
if (r->mixbus () || r->is_master()) {
switch (global_pos) {

View File

@ -414,6 +414,7 @@ Surface::setup_master ()
_master_fader->set_control (m->gain_control());
m->gain_control()->Changed.connect (master_connection, MISSING_INVALIDATOR, boost::bind (&Surface::master_gain_changed, this), ui_context());
_last_master_gain_written = FLT_MAX; /* some essentially impossible value */
_port->write (_master_fader->set_position (0.0));
master_gain_changed ();
}

View File

@ -117,7 +117,6 @@ US2400Protocol::US2400Protocol (Session& session)
, _scrub_mode (false)
, _view_mode (Mixer)
, _subview_mode (None)
, _current_selected_track (-1)
, _modifier_state (0)
, _metering_active (true)
, _initialized (false)
@ -343,7 +342,6 @@ US2400Protocol::switch_banks (uint32_t initial, bool force)
}
_current_initial_bank = initial;
_current_selected_track = -1;
// Map current bank of stripables onto each surface(+strip)
@ -559,6 +557,9 @@ US2400Protocol::device_ready ()
update_global_button (Button::Flip, on);
update_global_button (Button::Flip, off);
update_global_button (Button::MstrSelect, on);
update_global_button (Button::MstrSelect, off);
set_subview_mode (US2400Protocol::None, first_selected_stripable());
}
@ -1186,6 +1187,7 @@ US2400Protocol::build_button_map ()
DEFINE_BUTTON_HANDLER (Button::Left, &US2400Protocol::left_press, &US2400Protocol::left_release);
DEFINE_BUTTON_HANDLER (Button::Right, &US2400Protocol::right_press, &US2400Protocol::right_release);
DEFINE_BUTTON_HANDLER (Button::Flip, &US2400Protocol::flip_press, &US2400Protocol::flip_release);
DEFINE_BUTTON_HANDLER (Button::MstrSelect, &US2400Protocol::mstr_press, &US2400Protocol::mstr_release);
// DEFINE_BUTTON_HANDLER (Button::F1, &US2400Protocol::F1_press, &US2400Protocol::F1_release);
// DEFINE_BUTTON_HANDLER (Button::F2, &US2400Protocol::F2_press, &US2400Protocol::F2_release);
// DEFINE_BUTTON_HANDLER (Button::F3, &US2400Protocol::F3_press, &US2400Protocol::F3_release);
@ -1851,7 +1853,21 @@ US2400Protocol::stripable_selection_changed ()
(*si)->update_strip_selection ();
}
boost::shared_ptr<Stripable> s = first_selected_stripable ();
printf("stripable_selection_changed\n");
//first check for the dedicated Master strip
boost::shared_ptr<Stripable> s = ControlProtocol::first_selected_stripable();
if (s && s->is_master()) {
printf("stripable_selection_changed found master as selected_stripable\n");
update_global_button(Button::MstrSelect, on); //NOTE: surface does not respond to this
} else {
if (s) printf("stripable_selection_changed not master: %s\n", s->name().c_str());
update_global_button(Button::MstrSelect, off);
//not the master; now check for other strips ( this will only allow a selection if the strip is mapped on our surface )
s = first_selected_stripable ();
}
if (s) {
check_fader_automation_state ();
@ -1863,6 +1879,7 @@ US2400Protocol::stripable_selection_changed ()
*/
if (set_subview_mode (TrackView, s)) {
printf("set_subview_mode failed for master... (?)\n");
set_subview_mode (None, boost::shared_ptr<Stripable>());
}

View File

@ -293,7 +293,6 @@ class US2400Protocol
ViewMode _view_mode;
SubViewMode _subview_mode;
boost::shared_ptr<ARDOUR::Stripable> _subview_stripable;
int _current_selected_track;
int _modifier_state;
ButtonMap button_map;
bool _metering_active;
@ -396,6 +395,8 @@ class US2400Protocol
US2400::LedState dyn_release (US2400::Button &);
US2400::LedState flip_press (US2400::Button &);
US2400::LedState flip_release (US2400::Button &);
US2400::LedState mstr_press (US2400::Button &);
US2400::LedState mstr_release (US2400::Button &);
US2400::LedState name_value_press (US2400::Button &);
US2400::LedState name_value_release (US2400::Button &);
// US2400::LedState F1_press (US2400::Button &);