From 962ba01cfd852e7ca06b0469d2bfde5cda7a3fc1 Mon Sep 17 00:00:00 2001 From: Len Ovens Date: Thu, 13 Aug 2015 13:00:04 -0700 Subject: [PATCH] Fixed feedback for MCP buttons and LEDs not working. --- .../mackie/mackie_control_protocol.cc | 32 ++++++++++++------- .../surfaces/mackie/mackie_control_protocol.h | 1 + libs/surfaces/mackie/surface.cc | 2 -- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 5d6e55e742..34feabfbb8 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -271,7 +271,10 @@ MackieControlProtocol::get_sorted_routes() if (route_is_locked_to_strip(route)) { continue; } - + /* This next section which is not used yet, looks wrong to me + The first four belong here but the bottom five are not a selection + of routes and belong elsewhere as they are v-pot modes. + */ switch (_view_mode) { case Mixer: break; @@ -490,8 +493,8 @@ MackieControlProtocol::update_global_button (int id, LedState ls) if (!_device_info.has_global_controls()) { return; } - - boost::shared_ptr surface = surfaces.front(); + // surface needs to be master surface + boost::shared_ptr surface = _master_surface; map::iterator x = surface->controls_by_device_independent_id.find (id); if (x != surface->controls_by_device_independent_id.end()) { @@ -510,8 +513,7 @@ MackieControlProtocol::update_global_led (int id, LedState ls) if (!_device_info.has_global_controls()) { return; } - - boost::shared_ptr surface = surfaces.front(); + boost::shared_ptr surface = _master_surface; map::iterator x = surface->controls_by_device_independent_id.find (id); @@ -668,7 +670,7 @@ int MackieControlProtocol::create_surfaces () { string device_name; - surface_type_t stype = mcu; + surface_type_t stype = mcu; // type not yet determined char buf[128]; if (_device_info.extenders() == 0) { @@ -683,12 +685,21 @@ MackieControlProtocol::create_surfaces () boost::shared_ptr surface; + if (n == _device_info.master_position()) { + stype = mcu; + } else { + stype = ext; + } try { surface.reset (new Surface (*this, device_name, n, stype)); } catch (...) { return -1; } + if (n == _device_info.master_position()) { + _master_surface = surface; + } + if (_surfaces_state) { surface->set_state (*_surfaces_state, _surfaces_version); } @@ -697,8 +708,6 @@ MackieControlProtocol::create_surfaces () Glib::Threads::Mutex::Lock lm (surfaces_lock); surfaces.push_back (surface); } - - /* next device will be an extender */ if (_device_info.extenders() < 2) { device_name = X_("mackie control #2"); @@ -706,7 +715,6 @@ MackieControlProtocol::create_surfaces () snprintf (buf, sizeof (buf), X_("mackie control #%d"), n+2); device_name = buf; } - stype = ext; if (!_device_info.uses_ipmidi()) { @@ -921,7 +929,7 @@ MackieControlProtocol::update_timecode_display() return; } - boost::shared_ptr surface = surfaces.front(); + boost::shared_ptr surface = _master_surface; if (surface->type() != mcu || !_device_info.has_timecode_display() || !surface->active ()) { return; @@ -995,7 +1003,7 @@ MackieControlProtocol::notify_solo_active_changed (bool active) { Glib::Threads::Mutex::Lock lm (surfaces_lock); - surface = surfaces.front (); + surface = _master_surface; } map::iterator x = surface->controls_by_device_independent_id.find (Led::RudeSolo); @@ -1073,7 +1081,7 @@ MackieControlProtocol::notify_record_state_changed () { Glib::Threads::Mutex::Lock lm (surfaces_lock); - surface = surfaces.front(); + surface = _master_surface; } /* rec is a tristate */ diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h index f521684a80..170f1e0f26 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.h +++ b/libs/surfaces/mackie/mackie_control_protocol.h @@ -300,6 +300,7 @@ class MackieControlProtocol ARDOUR::RouteNotificationList _last_selected_routes; XMLNode* _surfaces_state; int _surfaces_version; + boost::shared_ptr _master_surface; struct ipMIDIHandler { MackieControlProtocol* mcp; diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc index fe0697f155..5a56e0b00d 100644 --- a/libs/surfaces/mackie/surface.cc +++ b/libs/surfaces/mackie/surface.cc @@ -734,8 +734,6 @@ Surface::zero_controls () } // turn off global buttons and leds - // global buttons are only ever on mcu_port, so we don't have - // to figure out which port. for (Controls::iterator it = controls.begin(); it != controls.end(); ++it) { Control & control = **it; -- 2.30.2