X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Fpush2%2Fpush2.h;h=7e480495ad6e5bba6c90fcb8ff30679f177d8b11;hb=cf28d717837857f1d568343bf17cc0b36db62269;hp=0ddfad2f15a098be92da537aedacdf12177957d9;hpb=f290be21ee896912553efbe5ec7f75d1d027ac13;p=ardour.git diff --git a/libs/surfaces/push2/push2.h b/libs/surfaces/push2/push2.h index 0ddfad2f15..7e480495ad 100644 --- a/libs/surfaces/push2/push2.h +++ b/libs/surfaces/push2/push2.h @@ -53,6 +53,7 @@ namespace MIDI { namespace ARDOUR { class AsyncMIDIPort; class Port; + class MidiBuffer; } namespace ArdourSurface { @@ -73,10 +74,19 @@ class Push2 : public ARDOUR::ControlProtocol static bool probe (); static void* request_factory (uint32_t); + bool has_editor () const { return true; } + void* get_gui () const; + void tear_down_gui (); + int set_active (bool yn); XMLNode& get_state(); int set_state (const XMLNode & node, int version); + PBD::Signal0 ConnectionChange; + + boost::shared_ptr input_port(); + boost::shared_ptr output_port(); + private: libusb_device_handle *handle; uint8_t frame_header[16]; @@ -89,6 +99,7 @@ class Push2 : public ARDOUR::ControlProtocol enum ModifierState { None = 0, ModShift = 0x1, + ModSelect = 0x2, }; ModifierState modifier_state; @@ -102,7 +113,7 @@ class Push2 : public ARDOUR::ControlProtocol int open (); int close (); bool redraw (); - int bitblt_to_device_frame_buffer (); + int blit_to_device_frame_buffer (); bool vblank (); enum ButtonID { @@ -229,6 +240,7 @@ class Push2 : public ARDOUR::ControlProtocol , id (bb) , press_method (&Push2::relax) , release_method (&Push2::relax) + , long_press_method (&Push2::relax) {} Button (ButtonID bb, uint8_t ex, void (Push2::*press)()) @@ -236,6 +248,7 @@ class Push2 : public ARDOUR::ControlProtocol , id (bb) , press_method (press) , release_method (&Push2::relax) + , long_press_method (&Push2::relax) {} Button (ButtonID bb, uint8_t ex, void (Push2::*press)(), void (Push2::*release)()) @@ -243,6 +256,15 @@ class Push2 : public ARDOUR::ControlProtocol , id (bb) , press_method (press) , release_method (release) + , long_press_method (&Push2::relax) + {} + + Button (ButtonID bb, uint8_t ex, void (Push2::*press)(), void (Push2::*release)(), void (Push2::*long_press)()) + : LED (ex) + , id (bb) + , press_method (press) + , release_method (release) + , long_press_method (long_press) {} MidiByteArray state_msg () const { return MidiByteArray (3, 0xb0|_state, _extra, _color_index); } @@ -251,6 +273,8 @@ class Push2 : public ARDOUR::ControlProtocol ButtonID id; void (Push2::*press_method)(); void (Push2::*release_method)(); + void (Push2::*long_press_method)(); + sigc::connection timeout_connection; }; struct ColorButton : public Button { @@ -263,6 +287,9 @@ class Push2 : public ARDOUR::ControlProtocol ColorButton (ButtonID bb, uint8_t ex, void (Push2::*press)(), void (Push2::*release)()) : Button (bb, ex, press, release) {} + + ColorButton (ButtonID bb, uint8_t ex, void (Push2::*press)(), void (Push2::*release)(), void (Push2::*long_press)()) + : Button (bb, ex, press, release, long_press) {} }; struct WhiteButton : public Button { @@ -274,6 +301,9 @@ class Push2 : public ARDOUR::ControlProtocol WhiteButton (ButtonID bb, uint8_t ex, void (Push2::*press)(), void (Push2::*release)()) : Button (bb, ex, press, release) {} + + WhiteButton (ButtonID bb, uint8_t ex, void (Push2::*press)(), void (Push2::*release)(), void (Push2::*long_press)()) + : Button (bb, ex, press, release, long_press) {} }; void relax () {} @@ -284,8 +314,14 @@ class Push2 : public ARDOUR::ControlProtocol /* map of Buttons by ButtonID */ typedef std::map IDButtonMap; IDButtonMap id_button_map; + std::set buttons_down; + std::set consumed; + + bool button_long_press_timeout (ButtonID id); + void start_press_timeout (Button&, ButtonID); - void init_buttons (); + void init_buttons (bool startup); + void init_touch_strip (); /* map of Pads by note number */ typedef std::map NNPadMap; @@ -344,8 +380,6 @@ class Push2 : public ARDOUR::ControlProtocol void button_solo (); void button_fixed_length (); void button_new (); - void button_shift_press (); - void button_shift_release (); void button_browse (); void button_clip (); void button_upper (uint32_t n); @@ -375,6 +409,28 @@ class Push2 : public ARDOUR::ControlProtocol void button_fwd8 (); void button_fwd4t (); void button_fwd4 (); + void button_add_track (); + void button_stop (); + void button_shift_press (); + void button_shift_release (); + void button_shift_long_press (); + void button_select_press (); + void button_select_release (); + void button_select_long_press (); + void button_page_left (); + void button_page_right (); + + void start_shift (); + void end_shift (); + void start_select (); + void end_select (); + + /* encoders */ + + void strip_vpot (int, int); + void other_vpot (int, int); + void strip_vpot_touch (int, bool); + void other_vpot_touch (int, bool); /* widgets */ @@ -385,6 +441,9 @@ class Push2 : public ARDOUR::ControlProtocol Glib::RefPtr mid_layout[8]; Glib::RefPtr lower_layout[8]; + void splash (); + ARDOUR::microseconds_t splash_start; + /* stripables */ int32_t bank_start; @@ -395,8 +454,31 @@ class Push2 : public ARDOUR::ControlProtocol void solo_change (int); void mute_change (int); + void stripable_property_change (PBD::PropertyChange const& what_changed, int which); void switch_bank (uint32_t base); + + bool pad_filter (ARDOUR::MidiBuffer& in, ARDOUR::MidiBuffer& out) const; + + boost::weak_ptr first_selected_stripable; + + PBD::ScopedConnection port_reg_connection; + void port_registration_handler (); + + enum ConnectionState { + InputConnected = 0x1, + OutputConnected = 0x2 + }; + + int connection_state; + bool connection_handler (boost::weak_ptr, std::string name1, boost::weak_ptr, std::string name2, bool yn); + PBD::ScopedConnection port_connection; + + /* GUI */ + + mutable void *gui; + void build_gui (); + };