for MCP devices that don't handshake, turn them on as soon as we call ::connectivity_...
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 6 Mar 2013 20:15:28 +0000 (20:15 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 6 Mar 2013 20:15:28 +0000 (20:15 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@14165 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/surfaces/mackie/mackie_control_protocol.cc
libs/surfaces/mackie/strip.cc
libs/surfaces/mackie/surface.cc
libs/surfaces/mackie/surface.h
libs/surfaces/mackie/surface_port.cc

index 1c367c4b472493341cbab12edf00ea6a6b068b6e..9749383ab6d5e265bd0151ae3ac336c8a3c7b87f 100644 (file)
@@ -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();
index 2b4368f4bb2a8b6d77a6ea69d7a7ddf1dfb364a0..fd8e956ba12943b7cf7119e357df10211cb17bf3 100644 (file)
@@ -297,12 +297,11 @@ Strip::notify_gain_changed (bool force_update)
                        control = _fader;
                }
 
-
                boost::shared_ptr<AutomationControl> 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()) {
index 1aa2a330261399904db697ddc84d80794f45dce8..0c45a293783fa19e440ff9907a18ef9cb1478028 100644 (file)
@@ -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");
        }
 }
 
index 1e66a478938b9ada4b99cd9ba7f2d91c01341b14..ecaa4171f705f72edeb41d6ce82bad138474e28e 100644 (file)
@@ -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 ();
 };
 
 }
index 9d0296a9a4d5355eadf463fb16ddb1c6970f6593..9f52f0dccdd38d5c994bdc0772cfd3a089c5d4d7 100644 (file)
@@ -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;
        }