diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-11-30 12:51:18 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-11-30 12:51:18 -0500 |
commit | 682e152aafbc49b5a7908fcd4b2734aed3b872e6 (patch) | |
tree | 4a031d962644148582123f7950730dfee1459e08 /libs/surfaces/faderport/faderport.h | |
parent | 149f6795bb3272aa31cf3dc5276667fb7454e7e3 (diff) |
faderport: some code cleanups, add timing for button presses, add new comboboxes to GUI to allow more button programming, save button state
Diffstat (limited to 'libs/surfaces/faderport/faderport.h')
-rw-r--r-- | libs/surfaces/faderport/faderport.h | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/libs/surfaces/faderport/faderport.h b/libs/surfaces/faderport/faderport.h index fc656d7f2a..0436e9e01e 100644 --- a/libs/surfaces/faderport/faderport.h +++ b/libs/surfaces/faderport/faderport.h @@ -151,6 +151,8 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq RewindDown = 0x2, StopDown = 0x4, UserDown = 0x8, + LongishPress = 0x10, + LongPress = 0x20 }; void set_action (ButtonID, std::string const& action_name, bool on_press, FaderPort::ButtonState = ButtonState (0)); @@ -190,15 +192,15 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq int last_encoder_delta, last_last_encoder_delta; void sysex_handler (MIDI::Parser &p, MIDI::byte *, size_t); - void switch_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb); + void button_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb); void encoder_handler (MIDI::Parser &, MIDI::pitchbend_t pb); void fader_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb); ButtonState button_state; - friend class ButtonInfo; + friend class Button; - class ButtonInfo { + class Button { public: enum ActionType { @@ -206,14 +208,15 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq InternalFunction, }; - ButtonInfo (FaderPort& f, std::string const& str, ButtonID i, int o) + Button (FaderPort& f, std::string const& str, ButtonID i, int o) : fp (f) , name (str) , id (i) , out (o) - , type (NamedAction) , led_on (false) , flash (false) + , pressed_at (0) + , long_press (0) {} void set_action (std::string const& action_name, bool on_press, FaderPort::ButtonState = ButtonState (0)); @@ -222,20 +225,26 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq 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&); private: FaderPort& fp; std::string name; ButtonID id; int out; - ActionType type; bool led_on; bool flash; + ARDOUR::microseconds_t pressed_at; + int long_press; - /* 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<void()> function; }; @@ -245,10 +254,10 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq ToDoMap on_release; }; - typedef std::map<ButtonID,ButtonInfo> ButtonMap; + typedef std::map<ButtonID,Button> ButtonMap; ButtonMap buttons; - ButtonInfo& button_info (ButtonID) const; + Button& get_button (ButtonID) const; void all_lights_out (); void close (); |