fix faderport's use of action name
[ardour.git] / libs / surfaces / faderport / faderport.h
index dd64700bf24f426bebcef1138993123d80c65c6d..4d5c9702d93e83330c056014200c3976dee1ad32 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <list>
 #include <map>
+#include <set>
 #include <glibmm/threads.h>
 
 #define ABSTRACT_UI_EXPORTS
@@ -54,6 +55,7 @@ namespace MIDI {
 
 namespace ARDOUR {
        class AsyncMIDIPort;
+       class Bundle;
        class Port;
        class Session;
        class MidiPort;
@@ -83,6 +85,7 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
           there's no way to know if the device exists or not.
         */
        static bool probe() { return true; }
+       static void* request_factory (uint32_t);
 
        XMLNode& get_state ();
        int set_state (const XMLNode&, int version);
@@ -143,6 +146,7 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
                Stop = 5,
                Play = 6,
                RecEnable = 7,
+               Footswitch = 126,
                FaderTouch = 127,
        };
 
@@ -157,14 +161,21 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
        void set_action (ButtonID, std::string const& action_name, bool on_press, FaderPort::ButtonState = ButtonState (0));
        std::string get_action (ButtonID, bool on_press, FaderPort::ButtonState = ButtonState (0));
 
+       std::list<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
+
   private:
-       boost::shared_ptr<ARDOUR::Route> _current_route;
-       boost::weak_ptr<ARDOUR::Route> pre_master_route;
-       boost::weak_ptr<ARDOUR::Route> pre_monitor_route;
+       boost::shared_ptr<ARDOUR::Stripable> _current_stripable;
+       boost::weak_ptr<ARDOUR::Stripable> pre_master_stripable;
+       boost::weak_ptr<ARDOUR::Stripable> pre_monitor_stripable;
 
        boost::shared_ptr<ARDOUR::AsyncMIDIPort> _input_port;
        boost::shared_ptr<ARDOUR::AsyncMIDIPort> _output_port;
 
+       // Bundle to represent our input ports
+       boost::shared_ptr<ARDOUR::Bundle> _input_bundle;
+       // Bundle to represent our output ports
+       boost::shared_ptr<ARDOUR::Bundle> _output_bundle;
+
        PBD::ScopedConnectionList midi_connections;
 
        bool midi_input_handler (Glib::IOCondition ioc, boost::shared_ptr<ARDOUR::AsyncMIDIPort> port);
@@ -213,34 +224,29 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
                        , name (str)
                        , id (i)
                        , out (o)
-                       , led_on (false)
                        , flash (false)
-                       , pressed_at (0)
-                       , long_press (false)
                {}
 
                void set_action (std::string const& action_name, bool on_press, FaderPort::ButtonState = ButtonState (0));
                void set_action (boost::function<void()> function, bool on_press, FaderPort::ButtonState = ButtonState (0));
                std::string get_action (bool press, FaderPort::ButtonState bs = ButtonState (0));
 
-               void set_led_state (boost::shared_ptr<MIDI::Port>, int onoff, bool force = false);
+               void set_led_state (boost::shared_ptr<MIDI::Port>, bool onoff);
                void invoke (ButtonState bs, bool press);
                bool uses_flash () const { return flash; }
                void set_flash (bool yn) { flash = yn; }
-               void do_timing (bool press);
 
                XMLNode& get_state () const;
                int set_state (XMLNode const&);
 
+               sigc::connection timeout_connection;
+
          private:
                FaderPort& fp;
                std::string name;
                ButtonID id;
                int out;
-               bool led_on;
                bool flash;
-               ARDOUR::microseconds_t pressed_at;
-               bool long_press;
 
                struct ToDo {
                        ActionType type;
@@ -261,6 +267,12 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
        ButtonMap buttons;
        Button& get_button (ButtonID) const;
 
+       std::set<ButtonID> buttons_down;
+       std::set<ButtonID> consumed;
+
+       bool button_long_press_timeout (ButtonID id);
+       void start_press_timeout (Button&, ButtonID);
+
        void all_lights_out ();
        void close ();
        void start_midi_handling ();
@@ -268,30 +280,37 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
 
        PBD::ScopedConnectionList session_connections;
        void connect_session_signals ();
-       void notify_record_state_changed ();
-       void notify_transport_state_changed ();
+       void map_recenable_state ();
+       void map_transport_state ();
+
+       sigc::connection periodic_connection;
+       bool periodic ();
 
        sigc::connection blink_connection;
        typedef std::list<ButtonID> Blinkers;
        Blinkers blinkers;
        bool blink_state;
        bool blink ();
+       void start_blinking (ButtonID);
+       void stop_blinking (ButtonID);
 
-       void set_current_route (boost::shared_ptr<ARDOUR::Route>);
-       void drop_current_route ();
+       void set_current_stripable (boost::shared_ptr<ARDOUR::Stripable>);
+       void drop_current_stripable ();
        void use_master ();
        void use_monitor ();
-       void gui_track_selection_changed (ARDOUR::RouteNotificationListPtr);
+       void gui_track_selection_changed (ARDOUR::StripableNotificationListPtr);
        PBD::ScopedConnection selection_connection;
-       PBD::ScopedConnectionList route_connections;
+       PBD::ScopedConnectionList stripable_connections;
 
-       void map_route_state ();
-       void map_solo (bool,void*,bool);
-       void map_listen (void*,bool);
-       void map_mute (void*);
+       void map_stripable_state ();
+       void map_solo ();
+       void map_mute ();
+       bool rec_enable_state;
        void map_recenable ();
        void map_gain ();
        void map_cut ();
+       void map_auto ();
+       void parameter_changed (std::string);
 
        /* operations (defined in operations.cc) */
 
@@ -313,6 +332,8 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
        void ardour_pan_azimuth (int);
        void ardour_pan_width (int);
        void mixbus_pan (int);
+
+       void punch ();
 };
 
 }