X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Ffaderport%2Ffaderport.h;h=4d5c9702d93e83330c056014200c3976dee1ad32;hb=00b8cff66fb971ead1a54e4b11e6dd869256461b;hp=8f920dfc4f0e04c829dfeebe5ea99cdd098aea02;hpb=6380403dad22f41861892ae7bd82e7deb67b2afe;p=ardour.git diff --git a/libs/surfaces/faderport/faderport.h b/libs/surfaces/faderport/faderport.h index 8f920dfc4f..4d5c9702d9 100644 --- a/libs/surfaces/faderport/faderport.h +++ b/libs/surfaces/faderport/faderport.h @@ -22,6 +22,7 @@ #include #include +#include #include #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 input_port(); boost::shared_ptr output_port(); + /* In a feat of engineering brilliance, the Presonus Faderport sends + * one button identifier when the button is pressed/released, but + * responds to another button identifier as a command to light the LED + * corresponding to the button. These ID's define what is sent + * for press/release; a separate data structure contains information + * on what to send to turn the LED on/off. + * + * One can only conclude that Presonus just didn't want to fix this + * issue because it contradicts their own documentation and is more or + * less the first thing you discover when programming the device. + */ + enum ButtonID { Mute = 18, Solo = 17, @@ -131,6 +146,7 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI > bundles (); private: - boost::shared_ptr _current_route; - boost::weak_ptr pre_master_route; - boost::weak_ptr pre_monitor_route; + boost::shared_ptr _current_stripable; + boost::weak_ptr pre_master_stripable; + boost::weak_ptr pre_monitor_stripable; boost::shared_ptr _input_port; boost::shared_ptr _output_port; + // Bundle to represent our input ports + boost::shared_ptr _input_bundle; + // Bundle to represent our output ports + boost::shared_ptr _output_bundle; + PBD::ScopedConnectionList midi_connections; bool midi_input_handler (Glib::IOCondition ioc, boost::shared_ptr port); @@ -178,15 +203,15 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI function, bool on_press, FaderPort::ButtonState = ButtonState (0)); - void set_led_state (boost::shared_ptr, int onoff, bool force = false); + std::string get_action (bool press, FaderPort::ButtonState bs = ButtonState (0)); + + void set_led_state (boost::shared_ptr, bool onoff); void invoke (ButtonState bs, bool press); bool uses_flash () const { return flash; } void set_flash (bool yn) { flash = yn; } + XMLNode& get_state () const; + int set_state (XMLNode const&); + + sigc::connection timeout_connection; + private: FaderPort& fp; std::string name; ButtonID id; int out; - ActionType type; - bool led_on; bool flash; - /* could be a union if boost::function didn't require a - * constructor - */ struct ToDo { + ActionType type; + /* could be a union if boost::function didn't require a + * constructor + */ std::string action_name; boost::function function; }; @@ -233,10 +262,16 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI ButtonMap; + typedef std::map ButtonMap; ButtonMap buttons; - ButtonInfo& button_info (ButtonID) const; + Button& get_button (ButtonID) const; + + std::set buttons_down; + std::set consumed; + + bool button_long_press_timeout (ButtonID id); + void start_press_timeout (Button&, ButtonID); void all_lights_out (); void close (); @@ -245,30 +280,37 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI Blinkers; Blinkers blinkers; bool blink_state; bool blink (); + void start_blinking (ButtonID); + void stop_blinking (ButtonID); - void set_current_route (boost::shared_ptr); - void drop_current_route (); + void set_current_stripable (boost::shared_ptr); + 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) */ @@ -290,6 +332,8 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI