X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fsurfaces%2Fpush2%2Fpush2.h;h=89982928bd09bcf09f1b078241ea05c52f7693a7;hb=e14694bfa3cc50f362fe2c7499782d13d055de3b;hp=11599b7b746781b2b09a89e85cb7e2213f1c32a8;hpb=3932f07b6b91f27f226a2e93fbdde7e8aac10857;p=ardour.git diff --git a/libs/surfaces/push2/push2.h b/libs/surfaces/push2/push2.h index 11599b7b74..89982928bd 100644 --- a/libs/surfaces/push2/push2.h +++ b/libs/surfaces/push2/push2.h @@ -21,25 +21,26 @@ #include #include +#include #include #include #include -#include - #define ABSTRACT_UI_EXPORTS #include "pbd/abstract_ui.h" + #include "midi++/types.h" + +#include "ardour/mode.h" #include "ardour/types.h" + #include "control_protocol/control_protocol.h" +#include "control_protocol/types.h" -#include "midi_byte_array.h" +#include "gtkmm2ext/colors.h" -namespace Cairo { - class ImageSurface; - class Context; -} +#include "midi_byte_array.h" namespace Pango { class Layout; @@ -53,6 +54,8 @@ namespace MIDI { namespace ARDOUR { class AsyncMIDIPort; class Port; + class MidiBuffer; + class MidiTrack; } namespace ArdourSurface { @@ -63,49 +66,15 @@ public: ~Push2Request () {} }; +class P2GUI; +class Push2Menu; +class Push2Layout; +class Push2Canvas; + class Push2 : public ARDOUR::ControlProtocol , public AbstractUI { - public: - Push2 (ARDOUR::Session&); - ~Push2 (); - - static bool probe (); - static void* request_factory (uint32_t); - - int set_active (bool yn); - XMLNode& get_state(); - int set_state (const XMLNode & node, int version); - - private: - libusb_device_handle *handle; - uint8_t frame_header[16]; - uint16_t* device_frame_buffer; - int device_buffer; - Cairo::RefPtr frame_buffer; - sigc::connection vblank_connection; - sigc::connection periodic_connection; - - enum ModifierState { - None = 0, - ModShift = 0x1, - ModSelect = 0x2, - }; - - ModifierState modifier_state; - - static const int cols; - static const int rows; - static const int pixels_per_row; - - void do_request (Push2Request*); - int stop (); - int open (); - int close (); - bool redraw (); - int blit_to_device_frame_buffer (); - bool vblank (); - + public: enum ButtonID { TapTempo, Metronome, @@ -191,7 +160,7 @@ class Push2 : public ARDOUR::ControlProtocol White = 122 }; - LED (uint8_t e) : _extra (e), _color_index (0), _state (NoTransition) {} + LED (uint8_t e) : _extra (e), _color_index (Black), _state (NoTransition) {} virtual ~LED() {} uint8_t extra () const { return _extra; } @@ -210,10 +179,20 @@ class Push2 : public ARDOUR::ControlProtocol }; struct Pad : public LED { + enum WhenPressed { + Nothing, + FlashOn, + FlashOff, + }; + Pad (int xx, int yy, uint8_t ex) : LED (ex) , x (xx) - , y (yy) {} + , y (yy) + , do_when_pressed (FlashOn) + , filtered (ex) + , perma_color (LED::Black) + {} MidiByteArray state_msg () const { return MidiByteArray (3, 0x90|_state, _extra, _color_index); } @@ -222,6 +201,9 @@ class Push2 : public ARDOUR::ControlProtocol int x; int y; + int do_when_pressed; + int filtered; + int perma_color; }; struct Button : public LED { @@ -296,34 +278,139 @@ class Push2 : public ARDOUR::ControlProtocol : Button (bb, ex, press, release, long_press) {} }; + enum ColorName { + DarkBackground, + LightBackground, + + ParameterName, + StripableName, + ClockText, + + KnobArcBackground, + KnobArcStart, + KnobArcEnd, + + KnobLine, + KnobLineShadow, + + KnobForeground, + KnobBackground, + KnobShadow, + KnobBorder, + }; + + enum PressureMode { + AfterTouch, + PolyPressure, + }; + + public: + Push2 (ARDOUR::Session&); + ~Push2 (); + + static bool probe (); + static void* request_factory (uint32_t); + + std::list > bundles (); + + 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(); + + int pad_note (int row, int col) const; + PBD::Signal0 PadChange; + + void update_selection_color (); + + void set_pad_scale (int root, int octave, MusicalMode::Type mode, bool inkey); + PBD::Signal0 ScaleChange; + + MusicalMode::Type mode() const { return _mode; } + int scale_root() const { return _scale_root; } + int root_octave() const { return _root_octave; } + bool in_key() const { return _in_key; } + + Push2Layout* current_layout() const; + void use_previous_layout (); + + Push2Canvas* canvas() const { return _canvas; } + + enum ModifierState { + None = 0, + ModShift = 0x1, + ModSelect = 0x2, + }; + + ModifierState modifier_state() const { return _modifier_state; } + + boost::shared_ptr