merge (w/fix) with master
[ardour.git] / libs / surfaces / mackie / strip.cc
index 84c32138a34ff1930a06942a3468eb5626f134ca..ef4447d900906d6a92f34957de7e1523a35b2014 100644 (file)
@@ -70,6 +70,7 @@ Strip::Strip (Surface& s, const std::string& name, int index, const map<Button::
        , _fader_touch (0)
        , _vpot (0)
        , _fader (0)
+       , _meter (0)
        , _index (index)
        , _surface (&s)
        , _controls_locked (false)
@@ -128,6 +129,7 @@ Strip::add (Control & control)
                        break;
                case Button::FaderTouch:
                        _fader_touch = button;
+                       break;
                default:
                        break;
                }
@@ -175,7 +177,7 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/)
 
        boost::shared_ptr<Pannable> pannable = _route->pannable();
 
-       if (pannable && pannable->panner()) {
+       if (pannable && _route->panner()) {
                pannable->pan_azimuth_control->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_panner_azi_changed, this, false), ui_context());
                pannable->pan_width_control->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_panner_width_changed, this, false), ui_context());
        }
@@ -209,7 +211,7 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/)
        possible_pot_parameters.clear();
 
        if (pannable) {
-               boost::shared_ptr<Panner> panner = pannable->panner();
+               boost::shared_ptr<Panner> panner = _route->panner();
                if (panner) {
                        set<Evoral::Parameter> automatable = panner->what_can_be_automated ();
                        set<Evoral::Parameter>::iterator a;
@@ -289,21 +291,20 @@ Strip::notify_gain_changed (bool force_update)
                
                Control* control;
 
-               if (_surface->mcp().flip_mode()) {
+               if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
                        control = _vpot;
                } else {
                        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()) {
+                       if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
                                if (!control->in_use()) {
                                        _surface->write (_vpot->set (normalized_position, true, Pot::wrap));
                                }
@@ -351,7 +352,7 @@ Strip::notify_panner_azi_changed (bool force_update)
 
                boost::shared_ptr<Pannable> pannable = _route->pannable();
 
-               if (!pannable || !pannable->panner()) {
+               if (!pannable || !_route->panner()) {
                        _surface->write (_vpot->zero());
                        return;
                }
@@ -390,7 +391,7 @@ Strip::notify_panner_width_changed (bool force_update)
 
                boost::shared_ptr<Pannable> pannable = _route->pannable();
 
-               if (!pannable || !pannable->panner()) {
+               if (!pannable || !_route->panner()) {
                        _surface->write (_vpot->zero());
                        return;
                }
@@ -406,7 +407,7 @@ Strip::notify_panner_width_changed (bool force_update)
                
                if (force_update || pos != _last_pan_azi_position_written) {
                        
-                       if (_surface->mcp().flip_mode()) {
+                       if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
 
                                if (control == _fader) {
                                        if (!control->in_use()) {
@@ -605,8 +606,8 @@ Strip::do_parameter_display (AutomationType type, float val)
        case PanAzimuthAutomation:
                if (_route) {
                        boost::shared_ptr<Pannable> p = _route->pannable();
-                       if (p && p->panner()) {
-                               string str = p->panner()->value_as_string (p->pan_azimuth_control);
+                       if (p && _route->panner()) {
+                               string str =_route->panner()->value_as_string (p->pan_azimuth_control);
                                _surface->write (display (1, str));
                        }
                }
@@ -943,7 +944,7 @@ Strip::next_pot_mode ()
 {
        vector<Evoral::Parameter>::iterator i;
 
-       if (_surface->mcp().flip_mode()) {
+       if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
                /* do not change vpot mode while in flipped mode */
                DEBUG_TRACE (DEBUG::MackieControl, "not stepping pot mode - in flip mode\n");
                _surface->write (display (1, "Flip"));
@@ -996,7 +997,7 @@ Strip::set_vpot_parameter (Evoral::Parameter p)
        case PanAzimuthAutomation:
                pannable = _route->pannable ();
                if (pannable) {
-                       if (_surface->mcp().flip_mode()) {
+                       if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
                                /* gain to vpot, pan azi to fader */
                                _vpot->set_control (_route->gain_control());
                                control_by_parameter[GainAutomation] = _vpot;
@@ -1024,7 +1025,7 @@ Strip::set_vpot_parameter (Evoral::Parameter p)
        case PanWidthAutomation:
                pannable = _route->pannable ();
                if (pannable) {
-                       if (_surface->mcp().flip_mode()) {
+                       if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
                                /* gain to vpot, pan width to fader */
                                _vpot->set_control (_route->gain_control());
                                control_by_parameter[GainAutomation] = _vpot;