Fix Mackie surface phase control for flip and more than one audio channel.
authorLen Ovens <len@ovenwerks.net>
Sun, 1 Nov 2015 23:30:36 +0000 (15:30 -0800)
committerLen Ovens <len@ovenwerks.net>
Sun, 1 Nov 2015 23:30:36 +0000 (15:30 -0800)
libs/ardour/ardour/route.h
libs/ardour/route.cc
libs/surfaces/mackie/strip.cc
libs/surfaces/mackie/strip.h

index d48519f9526a1b6bab075a3228329e8a39c012cd..2b80ea9a151515741a7b352d213038dfaf84a01c 100644 (file)
@@ -414,13 +414,13 @@ class LIBARDOUR_API Route : public SessionObject, public Automatable, public Rou
        public:
                PhaseControllable (std::string name, boost::shared_ptr<Route>);
                void set_value (double);
-               void set_channel (int);
+               void set_channel (uint32_t);
                double get_value () const;
-               int channel() const;
+               uint32_t channel() const;
 
        private:
                boost::weak_ptr<Route> _route;
-               int _current_phase;
+               uint32_t _current_phase;
        };
 
 
index a0dc130a7b697be1cb6701a66ed88cb1e0278083..62d97c79d37a4bc3b97af110558fb90632f4febf 100644 (file)
@@ -4007,12 +4007,12 @@ Route::PhaseControllable::get_value () const
 }
 
 void
-Route::PhaseControllable::set_channel (int c)
+Route::PhaseControllable::set_channel (uint32_t c)
 {
        _current_phase = c;
 }
 
-int
+uint32_t
 Route::PhaseControllable::channel () const
 {
        return _current_phase;
index 7b9d6a6864676bb04c9a0cbe89b087f7c04f0127..17d56f473a111794987432dabaaeae1646d8a91d 100644 (file)
@@ -96,6 +96,7 @@ Strip::Strip (Surface& s, const std::string& name, int index, const map<Button::
        , _block_vpot_mode_redisplay_until (0)
        , _block_screen_redisplay_until (0)
        , _pan_mode (PanAzimuthAutomation)
+       , _trim_mode (TrimAutomation)
        , _last_gain_position_written (-1.0)
        , _last_pan_azi_position_written (-1.0)
        , _last_pan_width_position_written (-1.0)
@@ -239,6 +240,7 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/)
 
        /* Update */
        _pan_mode = PanAzimuthAutomation;
+       _trim_mode = TrimAutomation;
        potmode_changed (true);
 
        notify_all ();
@@ -1084,11 +1086,11 @@ Strip::potmode_changed (bool notify)
                break;
        case MackieControlProtocol::Trim:
                DEBUG_TRACE (DEBUG::MackieControl, "Assign pot to Trim mode.\n");
-               set_vpot_parameter (TrimAutomation);
+               set_vpot_parameter (_trim_mode);
                break;
        case MackieControlProtocol::Send:
                DEBUG_TRACE (DEBUG::MackieControl, "Assign pot to Send mode.\n");
-               set_vpot_parameter (NullAutomation);
+               set_vpot_parameter (SendAutomation);
                break;
        }
 
@@ -1175,7 +1177,16 @@ Strip::next_pot_mode ()
                                break;
                        }
                }
-               // check for phase and more than one phase control
+               if ((*i).type() == PhaseAutomation && _route->phase_invert().size() > 1) {
+                       // There are more than one channel of phase
+                       if ((_route->phase_control()->channel() + 1) < _route->phase_invert().size()) {
+                               _route->phase_control()->set_channel(_route->phase_control()->channel() + 1);
+                               set_vpot_parameter (*i);
+                               return;
+                       } else {
+                               _route->phase_control()->set_channel(0);
+                       }
+               }
                /* move to the next mode in the list, or back to the start (which will
                also happen if the current mode is not in the current pot mode list)
                */
@@ -1272,6 +1283,7 @@ Strip::set_vpot_parameter (Evoral::Parameter p)
        case PanLFEAutomation:
                break;
        case TrimAutomation:
+               _trim_mode = TrimAutomation;
                if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
                        /* gain to vpot, trim to fader */
                        _vpot->set_control (_route->gain_control());
@@ -1297,6 +1309,7 @@ Strip::set_vpot_parameter (Evoral::Parameter p)
                }
                break;
        case PhaseAutomation:
+               _trim_mode = PhaseAutomation;
                if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
                        /* gain to vpot, phase to fader */
                        _vpot->set_control (_route->gain_control());
@@ -1321,8 +1334,8 @@ Strip::set_vpot_parameter (Evoral::Parameter p)
                        }
                }
                break;
-       case NullAutomation:
-               // deal with sends, phase, hidden, etc.
+       case SendAutomation:
+               // deal with sends ... needs sends yet :)
                if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
                        // gain to vpot, trim to fader
                        _vpot->set_control (_route->gain_control());
index e2f701830a0003cce56914b6850277656b5671cd..2fd33f323aa3342fca9ed60c9d823c18b8a25d52 100644 (file)
@@ -109,6 +109,7 @@ private:
        PBD::ScopedConnectionList route_connections;
 
        ARDOUR::AutomationType  _pan_mode;
+       ARDOUR::AutomationType  _trim_mode;
 
        float _last_gain_position_written;
        float _last_pan_azi_position_written;