implement more Faderport buttons (window and fader automation). ToDo: automation...
authorBen Loftis <ben@harrisonconsoles.com>
Wed, 25 Nov 2015 23:33:42 +0000 (17:33 -0600)
committerBen Loftis <ben@harrisonconsoles.com>
Wed, 25 Nov 2015 23:33:49 +0000 (17:33 -0600)
libs/surfaces/faderport/faderport.cc
libs/surfaces/faderport/faderport.h
libs/surfaces/faderport/operations.cc

index a8f89380693fe4f6af2803f8dc82d31b88575469..7d97e351e9c7de4727a814f822c79f448faf573b 100644 (file)
@@ -100,10 +100,10 @@ FaderPort::FaderPort (Session& s)
        buttons.insert (std::make_pair (Bank, ButtonInfo (*this, _("Bank"), Bank, 19)));
        buttons.insert (std::make_pair (Right, ButtonInfo (*this, _("Right"), Right, 18)));
        buttons.insert (std::make_pair (Output, ButtonInfo (*this, _("Output"), Output, 17)));
-       buttons.insert (std::make_pair (Read, ButtonInfo (*this, _("Read"), Read, 13)));
-       buttons.insert (std::make_pair (Write, ButtonInfo (*this, _("Write"), Write, 14)));
-       buttons.insert (std::make_pair (Touch, ButtonInfo (*this, _("Touch"), Touch, 15)));
-       buttons.insert (std::make_pair (Off, ButtonInfo (*this, _("Off"), Off, 16)));
+       buttons.insert (std::make_pair (FP_Read, ButtonInfo (*this, _("Read"), FP_Read, 13)));
+       buttons.insert (std::make_pair (FP_Write, ButtonInfo (*this, _("Write"), FP_Write, 14)));
+       buttons.insert (std::make_pair (FP_Touch, ButtonInfo (*this, _("Touch"), FP_Touch, 15)));
+       buttons.insert (std::make_pair (FP_Off, ButtonInfo (*this, _("Off"), FP_Off, 16)));
        buttons.insert (std::make_pair (Mix, ButtonInfo (*this, _("Mix"), Mix, 12)));
        buttons.insert (std::make_pair (Proj, ButtonInfo (*this, _("Proj"), Proj, 11)));
        buttons.insert (std::make_pair (Trns, ButtonInfo (*this, _("Trns"), Trns, 10)));
@@ -119,10 +119,22 @@ FaderPort::FaderPort (Session& s)
        buttons.insert (std::make_pair (RecEnable, ButtonInfo (*this, _("RecEnable"), RecEnable, 0)));
        buttons.insert (std::make_pair (FaderTouch, ButtonInfo (*this, _("Fader (touch)"), FaderTouch, -1)));
 
+       button_info (Mix).set_action ( string("Common/toggle-editor-mixer"), true);
+       button_info (Proj).set_action ( string("Common/toggle-meterbridge"), true);
+       button_info (Trns).set_action ( string("Window/toggle-locations"), true);
+
+       button_info (Left).set_action ( boost::bind (&FaderPort::left, this), true);
+       button_info (Right).set_action ( boost::bind (&FaderPort::right, this), true);
+
        button_info (Undo).set_action (boost::bind (&FaderPort::undo, this), true);
        button_info (Undo).set_action (boost::bind (&FaderPort::redo, this), true, ShiftDown);
        button_info (Undo).set_flash (true);
 
+       button_info (FP_Read).set_action (boost::bind (&FaderPort::read, this), true);
+       button_info (FP_Write).set_action (boost::bind (&FaderPort::write, this), true);
+       button_info (FP_Touch).set_action (boost::bind (&FaderPort::touch, this), true);
+       button_info (FP_Off).set_action (boost::bind (&FaderPort::off, this), true);
+
        button_info (Play).set_action (boost::bind (&BasicUI::transport_play, this, true), true);
        button_info (RecEnable).set_action (boost::bind (&BasicUI::rec_enable_toggle, this), true);
        /* Stop is a modifier, so we have to use its own button state to get
@@ -796,6 +808,8 @@ FaderPort::set_current_route (boost::shared_ptr<Route> r)
                        mp->cut_control()->Changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_cut, this), this);
                }
        }
+       
+       //ToDo: subscribe to the fader automation modes so we can light the LEDs
 
        map_route_state ();
 }
index cec673c743a04ab66774620853032ca0515f9265..cb5330f1c0148872367bc31f5b09eca1f30e1071 100644 (file)
@@ -148,10 +148,10 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
                Bank = 20,
                Right = 21,
                Output = 22,
-               Read = 10,
-               Write = 9,
-               Touch = 8,
-               Off = 23,
+               FP_Read = 10,
+               FP_Write = 9,
+               FP_Touch = 8,
+               FP_Off = 23,
                Mix = 11,
                Proj = 12,
                Trns = 13,
@@ -264,6 +264,15 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
 
        /* operations (defined in operations.cc) */
 
+       void read ();
+       void write ();
+
+       void left ();
+       void right ();
+
+       void touch ();
+       void off ();
+
        void undo ();
        void redo ();
        void solo ();
index 3c4d27a34504658f65b7756d86c6c30a61693d8e..fd9930be0c4d0d3d05357725d8d95bba570b9697 100644 (file)
 #include "ardour/rc_configuration.h"
 #include "ardour/session.h"
 #include "ardour/track.h"
+#include "ardour/types.h"
 
 #include "faderport.h"
 
 using namespace ARDOUR;
 using namespace ArdourSurface;
 
+void
+FaderPort::left ()
+{
+       access_action ("Editor/select-prev-route");
+
+       //ToDo:  bank by 8?
+       //if ( (button_state & ShiftDown) == ShiftDown )
+
+}
+
+void
+FaderPort::right ()
+{
+       access_action ("Editor/select-next-route");
+
+       //ToDo:  bank by 8?
+       //if ( (button_state & ShiftDown) == ShiftDown )
+}
+
+
+void
+FaderPort::read ()
+{
+       if (_current_route) {
+               boost::shared_ptr<AutomationControl> gain = _current_route->gain_control ();
+               if (gain) {
+                       gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Play );
+               }
+       }
+}
+
+void
+FaderPort::write ()
+{
+       if (_current_route) {
+               boost::shared_ptr<AutomationControl> gain = _current_route->gain_control ();
+               if (gain) {
+                       gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Write );
+               }
+       }
+}
+
+void
+FaderPort::touch ()
+{
+       if (_current_route) {
+               boost::shared_ptr<AutomationControl> gain = _current_route->gain_control ();
+               if (gain) {
+                       gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Touch );
+               }
+       }
+}
+
+void
+FaderPort::off ()
+{
+       if (_current_route) {
+               boost::shared_ptr<AutomationControl> gain = _current_route->gain_control ();
+               if (gain) {
+                       gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Off );
+               }
+       }
+}
+
+
+
+
 void
 FaderPort::undo ()
 {