MCP: make vpots control pan width + direction/position
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 11 Apr 2012 16:21:23 +0000 (16:21 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 11 Apr 2012 16:21:23 +0000 (16:21 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@11904 d708f5d6-7413-0410-9779-e7cbd77b26cf

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

index a4b2c0adb246aab82f25801ad94cd89d831b568b..c89bfa2c10892f82fdd89feb778889de2d6923f5 100644 (file)
@@ -83,6 +83,11 @@ class MackieControlProtocol
        , public AbstractUI<MackieControlUIRequest>
 {
   public:
+       static const int MODIFIER_OPTION;
+       static const int MODIFIER_CONTROL;
+       static const int MODIFIER_SHIFT;
+       static const int MODIFIER_CMDALT;
+
        MackieControlProtocol(ARDOUR::Session &);
        virtual ~MackieControlProtocol();
 
@@ -279,6 +284,8 @@ class MackieControlProtocol
        ARDOUR::Session & get_session() { return *session; }
  
        void add_in_use_timeout (Mackie::Surface& surface, Mackie::Control& in_use_control, Mackie::Control* touch_control);
+
+       int modifier_state();
        
   protected:
        // shut down the surface
@@ -363,12 +370,6 @@ class MackieControlProtocol
        bool _scrub_mode;
        bool _flip_mode;
        int  _current_selected_track;
-       
-       static const int MODIFIER_OPTION;
-       static const int MODIFIER_CONTROL;
-       static const int MODIFIER_SHIFT;
-       static const int MODIFIER_CMDALT;
-
        int  _modifier_state;
 
        typedef std::list<GSource*> PortSources;
index ddc982aeb6da9f3bb09b79c0669e6e13bd77fd29..b8327b82c13544f0619bb374833a263229ee054d 100644 (file)
@@ -520,16 +520,25 @@ Strip::handle_pot (Pot& pot, ControlState& state)
                return;
        }
 
-       boost::shared_ptr<Panner> panner = _route->panner_shell()->panner();
-       // pan for mono input routes, or stereo linked panners
-       if (panner) {
-               double p = panner->position ();
+       boost::shared_ptr<Pannable> pannable = _route->pannable();
+
+       if (pannable) {
+               boost::shared_ptr<AutomationControl> ac;
+               
+               if (_surface->mcp().modifier_state() & MackieControlProtocol::MODIFIER_CONTROL) {
+                       ac = pannable->pan_width_control;
+               } else {
+                       ac = pannable->pan_azimuth_control;
+               }
+               
+               double p = ac->get_value();
                 
                // calculate new value, and adjust
                p += state.delta * state.sign;
                p = min (1.0, p);
                p = max (0.0, p);
-               panner->set_position (p);
+
+               ac->set_value (p);
        }
 }