From: Paul Davis Date: Wed, 6 Mar 2013 20:15:28 +0000 (+0000) Subject: for MCP devices that don't handshake, turn them on as soon as we call ::connectivity_... X-Git-Tag: 3.0~35 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=8f091de64b436fdefa87ae6dae42e5a23889e3c2;p=ardour.git for MCP devices that don't handshake, turn them on as soon as we call ::connectivity_established() so that _active == true, and we will actually write to them git-svn-id: svn://localhost/ardour2/branches/3.0@14165 d708f5d6-7413-0410-9779-e7cbd77b26cf --- diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 1c367c4b47..9749383ab6 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -178,6 +178,12 @@ MackieControlProtocol::midi_connectivity_established () for (Surfaces::const_iterator si = surfaces.begin(); si != surfaces.end(); ++si) { (*si)->say_hello (); } + + if (_device_info.no_handshake()) { + for (Surfaces::const_iterator si = surfaces.begin(); si != surfaces.end(); ++si) { + (*si)->turn_it_on (); + } + } } // go to the previous track. @@ -532,21 +538,23 @@ MackieControlProtocol::update_surfaces() void MackieControlProtocol::initialize() { - Glib::Threads::Mutex::Lock lm (surfaces_lock); - - if (surfaces.empty()) { - return; - } - - if (!surfaces.front()->active ()) { - return; + { + Glib::Threads::Mutex::Lock lm (surfaces_lock); + + if (surfaces.empty()) { + return; + } + + if (!surfaces.front()->active ()) { + return; + } + + // sometimes the jog wheel is a pot + if (_device_info.has_jog_wheel()) { + surfaces.front()->blank_jog_ring (); + } } - // sometimes the jog wheel is a pot - if (_device_info.has_jog_wheel()) { - surfaces.front()->blank_jog_ring (); - } - // update global buttons and displays notify_record_state_changed(); diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index 2b4368f4bb..fd8e956ba1 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -297,12 +297,11 @@ Strip::notify_gain_changed (bool force_update) control = _fader; } - boost::shared_ptr ac = _route->gain_control(); float gain_coefficient = ac->get_value(); float normalized_position = ac->internal_to_interface (gain_coefficient); - + if (force_update || normalized_position != _last_gain_position_written) { if (_surface->mcp().flip_mode()) { diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc index 1aa2a33026..0c45a29378 100644 --- a/libs/surfaces/mackie/surface.cc +++ b/libs/surfaces/mackie/surface.cc @@ -698,6 +698,8 @@ Surface::write (const MidiByteArray& data) { if (_active) { _port->write (data); + } else { + DEBUG_TRACE (DEBUG::MackieControl, "surface not active, write ignored\n"); } } diff --git a/libs/surfaces/mackie/surface.h b/libs/surfaces/mackie/surface.h index 1e66a47893..ecaa4171f7 100644 --- a/libs/surfaces/mackie/surface.h +++ b/libs/surfaces/mackie/surface.h @@ -146,7 +146,8 @@ public: void next_jog_mode (); void set_jog_mode (Mackie::JogWheel::Mode); - void notify_metering_state_changed(); + void notify_metering_state_changed(); + void turn_it_on (); protected: @@ -170,7 +171,6 @@ public: void init_strips (uint32_t n); void setup_master (); void master_gain_changed (); - void turn_it_on (); }; } diff --git a/libs/surfaces/mackie/surface_port.cc b/libs/surfaces/mackie/surface_port.cc index 9d0296a9a4..9f52f0dccd 100644 --- a/libs/surfaces/mackie/surface_port.cc +++ b/libs/surfaces/mackie/surface_port.cc @@ -112,6 +112,7 @@ int SurfacePort::write (const MidiByteArray & mba) { if (mba.empty()) { + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("port %1 asked to write an empty MBA\n", output_port().name())); return 0; }