MCP: probably fix crash from flip mode, and debug modifier state in pothandler
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 12 Apr 2012 01:05:18 +0000 (01:05 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 12 Apr 2012 01:05:18 +0000 (01:05 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@11932 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/surfaces/mackie/strip.cc

index 7304301e519289a21ce532124e2ed5a40bea6e41..5c5b7264e50cfa00772aa84c1ac9f1562def084c 100644 (file)
@@ -473,6 +473,7 @@ Strip::handle_pot (Pot& pot, float delta)
                case MackieControlProtocol::Normal: /* pot controls pan */
                case MackieControlProtocol::Mirror: /* pot + fader control pan */
                case MackieControlProtocol::Zero:   /* pot controls pan, faders don't move */
+                       DEBUG_TRACE (DEBUG::MackieControl, string_compose ("modifier state %1\n", _surface->mcp().modifier_state()));
                        if (_surface->mcp().modifier_state() & MackieControlProtocol::MODIFIER_CONTROL) {
                                DEBUG_TRACE (DEBUG::MackieControl, "pot using control to alter width\n");
                                ac = pannable->pan_width_control;
@@ -486,14 +487,16 @@ Strip::handle_pot (Pot& pot, float delta)
                        break;
                }
 
-               double p = ac->get_value();
-                
-               // calculate new value, and adjust
-               p += delta;
-               p = min (1.0, p);
-               p = max (0.0, p);
-
-               ac->set_value (p);
+               if (ac) {
+                       double p = ac->get_value();
+                       
+                       // calculate new value, and adjust
+                       p += delta;
+                       p = min (1.0, p);
+                       p = max (0.0, p);
+                       
+                       ac->set_value (p);
+               }
        }
 }