13
0

mackie: properly track lifetime of subview route; fix subview/potmode LED state mgmt

This commit is contained in:
Paul Davis 2015-12-15 11:10:35 -05:00
parent a9a4cfb166
commit 93d5fe83c8
3 changed files with 49 additions and 13 deletions

View File

@ -1618,18 +1618,35 @@ MackieControlProtocol::clear_ports ()
}
}
void
MackieControlProtocol::notify_subview_route_deleted ()
{
/* return to global/mixer view */
_subview_route.reset ();
set_view_mode (Mixer);
}
void
MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Route> r)
{
SubViewMode old = _subview_mode;
SubViewMode old_mode = _subview_mode;
boost::shared_ptr<Route> old_route = _subview_route;
_subview_mode = sm;
if (r) {
/* retain _subview_route even if it is reset to null implicitly */
_subview_route = r;
}
if (_subview_mode != old) {
if ((_subview_mode != old_mode) || (_subview_route != old_route)) {
if (r != old_route) {
subview_route_connections.drop_connections ();
if (_subview_route) {
_subview_route->DropReferences.connect (subview_route_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_subview_route_deleted, this), this);
}
}
/* subview mode did actually change */
@ -1646,14 +1663,31 @@ MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Route
}
}
if (_subview_mode != old_mode) {
/* turn buttons related to vpot mode on or off as required */
if (_subview_mode != None) {
switch (_subview_mode) {
case MackieControlProtocol::None:
pot_mode_globals ();
break;
case MackieControlProtocol::EQ:
update_global_button (Button::Eq, on);
update_global_button (Button::Dyn, off);
update_global_button (Button::AudioInstruments, off); /* faking up Dyn */
update_global_button (Button::Trim, off);
update_global_button (Button::Send, off);
update_global_button (Button::Pan, off);
} else {
pot_mode_globals ();
break;
case MackieControlProtocol::Dynamics:
update_global_button (Button::Eq, off);
update_global_button (Button::Dyn, on);
update_global_button (Button::AudioInstruments, on); /* faking up Dyn */
update_global_button (Button::Trim, off);
update_global_button (Button::Send, off);
update_global_button (Button::Pan, off);
break;
}
}
}
}

View File

@ -201,6 +201,7 @@ class MackieControlProtocol
void handle_button_event (Mackie::Surface&, Mackie::Button& button, Mackie::ButtonState);
void notify_subview_route_deleted ();
void notify_route_added_or_removed ();
void notify_route_added (ARDOUR::RouteList &);
void notify_remote_id_changed();
@ -318,6 +319,7 @@ class MackieControlProtocol
PBD::ScopedConnectionList audio_engine_connections;
PBD::ScopedConnectionList session_connections;
PBD::ScopedConnectionList route_connections;
PBD::ScopedConnectionList subview_route_connections;
PBD::ScopedConnectionList gui_connections;
// timer for two quick marker left presses
Mackie::Timer _frm_left_last;

View File

@ -711,7 +711,7 @@ MackieControlProtocol::eq_press (Button &)
boost::shared_ptr<Route> r = first_selected_route ();
if (r && r->eq_band_cnt() > 0) {
set_subview_mode (EQ, r);
return on;
return none; /* led state handled by set_subview_mode() */
}
}
return none;
@ -730,7 +730,7 @@ MackieControlProtocol::dyn_press (Button &)
if (r) {
set_subview_mode (Dynamics, r);
return on;
return none; /* led state handled by set_subview_mode() */
}
}