13
0

Make mackie control view mode save bank for all modes.

Also moved duplicated code to one function.
This commit is contained in:
Len Ovens 2015-10-22 15:30:34 -07:00
parent f4100dc529
commit 96c6da0804
3 changed files with 18 additions and 24 deletions

View File

@ -124,6 +124,12 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
DeviceInfo::reload_device_info ();
DeviceProfile::reload_device_profiles ();
for (int i = 0; i < 9; i++) {
_last_bank[i] = 0;
}
_last_bank[Mixer] = _current_selected_track;
TrackSelectionChanged.connect (gui_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::gui_track_selection_changed, this, _1, true), this);
_instance = this;
@ -396,7 +402,7 @@ MackieControlProtocol::switch_banks (uint32_t initial, bool force)
}
/* reset this to get the right display of view mode after the switch */
set_view_mode (_view_mode);
display_view_mode ();
/* make sure selection is correct */
@ -1553,10 +1559,18 @@ MackieControlProtocol::clear_ports ()
void
MackieControlProtocol::set_view_mode (ViewMode m)
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
_last_bank[_view_mode] = _current_initial_bank;
_view_mode = m;
switch_banks(_last_bank[_view_mode], true);
}
void
MackieControlProtocol::display_view_mode ()
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
(*s)->update_view_mode_display ();
}

View File

@ -155,6 +155,7 @@ class MackieControlProtocol
void set_view_mode (ViewMode);
void set_flip_mode (FlipMode);
void set_pot_mode (PotMode);
void display_view_mode ();
XMLNode& get_state ();
int set_state (const XMLNode&, int version);
@ -328,7 +329,7 @@ class MackieControlProtocol
ARDOUR::RouteNotificationList _last_selected_routes;
XMLNode* configuration_state;
int state_version;
int _last_mix_bank;
int _last_bank[9];
boost::shared_ptr<ArdourSurface::Mackie::Surface> _master_surface;

View File

@ -857,11 +857,7 @@ MackieControlProtocol::miditracks_press (Mackie::Button&)
Mackie::LedState
MackieControlProtocol::miditracks_release (Mackie::Button&)
{
if (_view_mode == Mixer) {
_last_mix_bank = _current_initial_bank;
}
set_view_mode (MidiTracks);
switch_banks(0, true);
return none;
}
Mackie::LedState
@ -882,11 +878,7 @@ MackieControlProtocol::audiotracks_press (Mackie::Button&)
Mackie::LedState
MackieControlProtocol::audiotracks_release (Mackie::Button&)
{
if (_view_mode == Mixer) {
_last_mix_bank = _current_initial_bank;
}
set_view_mode (AudioTracks);
switch_banks(0, true);
return none;
}
Mackie::LedState
@ -907,11 +899,7 @@ MackieControlProtocol::aux_press (Mackie::Button&)
Mackie::LedState
MackieControlProtocol::aux_release (Mackie::Button&)
{
if (_view_mode == Mixer) {
_last_mix_bank = _current_initial_bank;
}
set_view_mode (Auxes);
switch_banks(0, true);
return none;
}
Mackie::LedState
@ -922,11 +910,7 @@ MackieControlProtocol::busses_press (Mackie::Button&)
Mackie::LedState
MackieControlProtocol::busses_release (Mackie::Button&)
{
if (_view_mode == Mixer) {
_last_mix_bank = _current_initial_bank;
}
set_view_mode (Busses);
switch_banks(0, true);
return none;
}
Mackie::LedState
@ -947,11 +931,7 @@ MackieControlProtocol::user_press (Mackie::Button&)
Mackie::LedState
MackieControlProtocol::user_release (Mackie::Button&)
{
if (_view_mode == Mixer) {
_last_mix_bank = _current_initial_bank;
}
set_view_mode (Selected);
switch_banks(0, true);
return none;
}
Mackie::LedState
@ -1018,7 +998,6 @@ Mackie::LedState
MackieControlProtocol::view_press (Mackie::Button&)
{
set_view_mode (Mixer);
switch_banks (_last_mix_bank, true);
return none;
}
Mackie::LedState