2016-06-15 22:41:01 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2016 Paul Davis
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ardour_push2_h__
|
|
|
|
#define __ardour_push2_h__
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
2016-07-10 15:22:16 -04:00
|
|
|
#include <stack>
|
2016-06-15 22:41:01 -04:00
|
|
|
#include <list>
|
|
|
|
#include <set>
|
|
|
|
|
|
|
|
#include <libusb.h>
|
|
|
|
|
|
|
|
#define ABSTRACT_UI_EXPORTS
|
|
|
|
#include "pbd/abstract_ui.h"
|
2016-07-07 09:42:26 -04:00
|
|
|
|
2016-06-15 22:41:01 -04:00
|
|
|
#include "midi++/types.h"
|
2016-07-07 09:42:26 -04:00
|
|
|
|
2016-09-28 11:47:10 -04:00
|
|
|
#include "ardour/mode.h"
|
2016-06-15 22:41:01 -04:00
|
|
|
#include "ardour/types.h"
|
2016-07-07 09:42:26 -04:00
|
|
|
|
2016-06-15 22:41:01 -04:00
|
|
|
#include "control_protocol/control_protocol.h"
|
2016-07-07 09:42:26 -04:00
|
|
|
#include "control_protocol/types.h"
|
2016-06-15 22:41:01 -04:00
|
|
|
|
2016-09-22 00:05:01 -04:00
|
|
|
#include "canvas/colors.h"
|
|
|
|
|
2016-06-16 10:02:46 -04:00
|
|
|
#include "midi_byte_array.h"
|
|
|
|
|
2016-06-16 22:51:30 -04:00
|
|
|
namespace Pango {
|
|
|
|
class Layout;
|
2016-06-16 00:07:43 -04:00
|
|
|
}
|
2016-06-15 22:41:01 -04:00
|
|
|
|
2016-06-16 10:02:46 -04:00
|
|
|
namespace MIDI {
|
|
|
|
class Parser;
|
|
|
|
class Port;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class AsyncMIDIPort;
|
|
|
|
class Port;
|
2016-06-20 08:31:33 -04:00
|
|
|
class MidiBuffer;
|
2016-07-07 09:42:26 -04:00
|
|
|
class MidiTrack;
|
2016-06-16 10:02:46 -04:00
|
|
|
}
|
|
|
|
|
2016-06-15 22:41:01 -04:00
|
|
|
namespace ArdourSurface {
|
|
|
|
|
|
|
|
struct Push2Request : public BaseUI::BaseRequestObject {
|
|
|
|
public:
|
|
|
|
Push2Request () {}
|
|
|
|
~Push2Request () {}
|
|
|
|
};
|
|
|
|
|
2016-07-07 00:10:27 -04:00
|
|
|
class P2GUI;
|
2016-07-10 08:37:45 -04:00
|
|
|
class Push2Menu;
|
2016-07-10 10:49:39 -04:00
|
|
|
class Push2Layout;
|
2016-09-16 09:39:28 -04:00
|
|
|
class Push2Canvas;
|
2016-07-07 00:10:27 -04:00
|
|
|
|
2016-06-15 22:41:01 -04:00
|
|
|
class Push2 : public ARDOUR::ControlProtocol
|
|
|
|
, public AbstractUI<Push2Request>
|
|
|
|
{
|
2016-07-10 10:49:39 -04:00
|
|
|
public:
|
2016-06-16 14:06:16 -04:00
|
|
|
enum ButtonID {
|
|
|
|
TapTempo,
|
|
|
|
Metronome,
|
|
|
|
Upper1, Upper2, Upper3, Upper4, Upper5, Upper6, Upper7, Upper8,
|
|
|
|
Setup,
|
|
|
|
User,
|
|
|
|
Delete,
|
|
|
|
AddDevice,
|
|
|
|
Device,
|
|
|
|
Mix,
|
|
|
|
Undo,
|
|
|
|
AddTrack,
|
|
|
|
Browse,
|
|
|
|
Clip,
|
|
|
|
Mute,
|
|
|
|
Solo,
|
|
|
|
Stop,
|
|
|
|
Lower1, Lower2, Lower3, Lower4, Lower5, Lower6, Lower7, Lower8,
|
|
|
|
Master,
|
|
|
|
Convert,
|
|
|
|
DoubleLoop,
|
|
|
|
Quantize,
|
|
|
|
Duplicate,
|
|
|
|
New,
|
|
|
|
FixedLength,
|
|
|
|
Automate,
|
|
|
|
RecordEnable,
|
|
|
|
Play,
|
|
|
|
Fwd32ndT,
|
|
|
|
Fwd32nd,
|
|
|
|
Fwd16thT,
|
|
|
|
Fwd16th,
|
|
|
|
Fwd8thT,
|
|
|
|
Fwd8th,
|
|
|
|
Fwd4trT,
|
|
|
|
Fwd4tr,
|
|
|
|
Up,
|
|
|
|
Right,
|
|
|
|
Down,
|
|
|
|
Left,
|
|
|
|
Repeat,
|
|
|
|
Accent,
|
|
|
|
Scale,
|
|
|
|
Layout,
|
|
|
|
Note,
|
|
|
|
Session,
|
|
|
|
OctaveUp,
|
|
|
|
PageRight,
|
|
|
|
OctaveDown,
|
|
|
|
PageLeft,
|
|
|
|
Shift,
|
|
|
|
Select
|
|
|
|
};
|
|
|
|
|
2016-06-16 10:02:46 -04:00
|
|
|
struct LED
|
|
|
|
{
|
|
|
|
enum State {
|
2016-06-17 00:15:55 -04:00
|
|
|
NoTransition,
|
2016-06-16 10:02:46 -04:00
|
|
|
OneShot24th,
|
|
|
|
OneShot16th,
|
|
|
|
OneShot8th,
|
|
|
|
OneShot4th,
|
|
|
|
OneShot2th,
|
|
|
|
Pulsing24th,
|
|
|
|
Pulsing16th,
|
|
|
|
Pulsing8th,
|
|
|
|
Pulsing4th,
|
|
|
|
Pulsing2th,
|
|
|
|
Blinking24th,
|
|
|
|
Blinking16th,
|
|
|
|
Blinking8th,
|
|
|
|
Blinking4th,
|
|
|
|
Blinking2th
|
|
|
|
};
|
|
|
|
|
2016-06-16 17:45:41 -04:00
|
|
|
enum Colors {
|
2016-06-17 00:15:55 -04:00
|
|
|
Black = 0,
|
2016-06-16 17:45:41 -04:00
|
|
|
Red = 127,
|
|
|
|
Green = 126,
|
|
|
|
Blue = 125,
|
|
|
|
DarkGray = 124,
|
|
|
|
LightGray = 123,
|
|
|
|
White = 122
|
|
|
|
};
|
|
|
|
|
2016-07-07 14:26:55 -04:00
|
|
|
LED (uint8_t e) : _extra (e), _color_index (Black), _state (NoTransition) {}
|
2016-06-16 14:06:16 -04:00
|
|
|
virtual ~LED() {}
|
2016-06-16 10:02:46 -04:00
|
|
|
|
2016-06-16 14:06:16 -04:00
|
|
|
uint8_t extra () const { return _extra; }
|
|
|
|
uint8_t color_index () const { return _color_index; }
|
|
|
|
State state () const { return _state; }
|
2016-06-16 10:02:46 -04:00
|
|
|
|
2016-06-16 14:06:16 -04:00
|
|
|
void set_color (uint8_t color_index);
|
|
|
|
void set_state (State state);
|
2016-06-16 10:02:46 -04:00
|
|
|
|
2016-06-16 14:06:16 -04:00
|
|
|
virtual MidiByteArray state_msg() const = 0;
|
2016-06-16 10:02:46 -04:00
|
|
|
|
2016-06-16 14:06:16 -04:00
|
|
|
protected:
|
|
|
|
uint8_t _extra;
|
|
|
|
uint8_t _color_index;
|
|
|
|
State _state;
|
|
|
|
};
|
2016-06-16 10:02:46 -04:00
|
|
|
|
2016-06-16 14:06:16 -04:00
|
|
|
struct Pad : public LED {
|
2016-07-07 14:26:55 -04:00
|
|
|
enum WhenPressed {
|
|
|
|
Nothing,
|
|
|
|
FlashOn,
|
|
|
|
FlashOff,
|
|
|
|
};
|
|
|
|
|
2016-06-16 14:06:16 -04:00
|
|
|
Pad (int xx, int yy, uint8_t ex)
|
|
|
|
: LED (ex)
|
|
|
|
, x (xx)
|
2016-07-07 14:26:55 -04:00
|
|
|
, y (yy)
|
|
|
|
, do_when_pressed (FlashOn)
|
|
|
|
, filtered (ex)
|
|
|
|
, perma_color (LED::Black)
|
|
|
|
{}
|
2016-06-16 10:02:46 -04:00
|
|
|
|
2016-06-17 00:15:55 -04:00
|
|
|
MidiByteArray state_msg () const { return MidiByteArray (3, 0x90|_state, _extra, _color_index); }
|
2016-06-16 14:06:16 -04:00
|
|
|
|
|
|
|
int coord () const { return (y * 8) + x; }
|
|
|
|
int note_number() const { return extra(); }
|
|
|
|
|
|
|
|
int x;
|
|
|
|
int y;
|
2016-07-07 14:26:55 -04:00
|
|
|
int do_when_pressed;
|
|
|
|
int filtered;
|
|
|
|
int perma_color;
|
2016-06-16 14:06:16 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Button : public LED {
|
|
|
|
Button (ButtonID bb, uint8_t ex)
|
|
|
|
: LED (ex)
|
|
|
|
, id (bb)
|
|
|
|
, press_method (&Push2::relax)
|
|
|
|
, release_method (&Push2::relax)
|
2016-06-17 15:51:16 -04:00
|
|
|
, long_press_method (&Push2::relax)
|
2016-06-16 14:06:16 -04:00
|
|
|
{}
|
|
|
|
|
|
|
|
Button (ButtonID bb, uint8_t ex, void (Push2::*press)())
|
|
|
|
: LED (ex)
|
|
|
|
, id (bb)
|
|
|
|
, press_method (press)
|
|
|
|
, release_method (&Push2::relax)
|
2016-06-17 15:51:16 -04:00
|
|
|
, long_press_method (&Push2::relax)
|
2016-06-16 14:06:16 -04:00
|
|
|
{}
|
|
|
|
|
|
|
|
Button (ButtonID bb, uint8_t ex, void (Push2::*press)(), void (Push2::*release)())
|
|
|
|
: LED (ex)
|
|
|
|
, id (bb)
|
|
|
|
, press_method (press)
|
|
|
|
, release_method (release)
|
2016-06-17 15:51:16 -04:00
|
|
|
, 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)
|
2016-06-16 14:06:16 -04:00
|
|
|
{}
|
|
|
|
|
2016-06-17 00:15:55 -04:00
|
|
|
MidiByteArray state_msg () const { return MidiByteArray (3, 0xb0|_state, _extra, _color_index); }
|
2016-06-16 14:06:16 -04:00
|
|
|
int controller_number() const { return extra(); }
|
|
|
|
|
|
|
|
ButtonID id;
|
|
|
|
void (Push2::*press_method)();
|
|
|
|
void (Push2::*release_method)();
|
2016-06-17 15:51:16 -04:00
|
|
|
void (Push2::*long_press_method)();
|
|
|
|
sigc::connection timeout_connection;
|
2016-06-16 14:06:16 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ColorButton : public Button {
|
|
|
|
ColorButton (ButtonID bb, uint8_t ex)
|
|
|
|
: Button (bb, ex) {}
|
|
|
|
|
|
|
|
|
|
|
|
ColorButton (ButtonID bb, uint8_t ex, void (Push2::*press)())
|
|
|
|
: Button (bb, ex, press) {}
|
|
|
|
|
|
|
|
ColorButton (ButtonID bb, uint8_t ex, void (Push2::*press)(), void (Push2::*release)())
|
|
|
|
: Button (bb, ex, press, release) {}
|
2016-06-17 15:51:16 -04:00
|
|
|
|
|
|
|
ColorButton (ButtonID bb, uint8_t ex, void (Push2::*press)(), void (Push2::*release)(), void (Push2::*long_press)())
|
|
|
|
: Button (bb, ex, press, release, long_press) {}
|
2016-06-16 10:02:46 -04:00
|
|
|
};
|
|
|
|
|
2016-06-16 14:06:16 -04:00
|
|
|
struct WhiteButton : public Button {
|
|
|
|
WhiteButton (ButtonID bb, uint8_t ex)
|
|
|
|
: Button (bb, ex) {}
|
|
|
|
|
|
|
|
WhiteButton (ButtonID bb, uint8_t ex, void (Push2::*press)())
|
|
|
|
: Button (bb, ex, press) {}
|
|
|
|
|
|
|
|
WhiteButton (ButtonID bb, uint8_t ex, void (Push2::*press)(), void (Push2::*release)())
|
|
|
|
: Button (bb, ex, press, release) {}
|
2016-06-17 15:51:16 -04:00
|
|
|
|
|
|
|
WhiteButton (ButtonID bb, uint8_t ex, void (Push2::*press)(), void (Push2::*release)(), void (Push2::*long_press)())
|
|
|
|
: Button (bb, ex, press, release, long_press) {}
|
2016-06-16 14:06:16 -04:00
|
|
|
};
|
|
|
|
|
2016-07-11 09:07:52 -04:00
|
|
|
enum ColorName {
|
|
|
|
DarkBackground,
|
|
|
|
LightBackground,
|
|
|
|
|
|
|
|
ParameterName,
|
2016-07-11 10:02:35 -04:00
|
|
|
StripableName,
|
|
|
|
ClockText,
|
2016-07-11 09:07:52 -04:00
|
|
|
|
|
|
|
KnobArcBackground,
|
|
|
|
KnobArcStart,
|
|
|
|
KnobArcEnd,
|
|
|
|
|
|
|
|
KnobLine,
|
|
|
|
KnobLineShadow,
|
|
|
|
|
|
|
|
KnobForeground,
|
|
|
|
KnobBackground,
|
|
|
|
KnobShadow,
|
|
|
|
KnobBorder,
|
|
|
|
};
|
|
|
|
|
2016-08-25 19:57:02 -04:00
|
|
|
enum PressureMode {
|
|
|
|
AfterTouch,
|
|
|
|
PolyPressure,
|
|
|
|
};
|
|
|
|
|
2016-07-10 10:49:39 -04:00
|
|
|
public:
|
|
|
|
Push2 (ARDOUR::Session&);
|
|
|
|
~Push2 ();
|
|
|
|
|
|
|
|
static bool probe ();
|
|
|
|
static void* request_factory (uint32_t);
|
|
|
|
|
|
|
|
std::list<boost::shared_ptr<ARDOUR::Bundle> > 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<void> ConnectionChange;
|
|
|
|
|
|
|
|
boost::shared_ptr<ARDOUR::Port> input_port();
|
|
|
|
boost::shared_ptr<ARDOUR::Port> output_port();
|
|
|
|
|
|
|
|
int pad_note (int row, int col) const;
|
|
|
|
PBD::Signal0<void> PadChange;
|
|
|
|
|
2016-09-23 14:56:27 -04:00
|
|
|
void update_selection_color ();
|
|
|
|
|
2016-07-10 10:49:39 -04:00
|
|
|
void set_pad_scale (int root, int octave, MusicalMode::Type mode, bool inkey);
|
2016-09-21 16:25:44 -04:00
|
|
|
PBD::Signal0<void> ScaleChange;
|
2016-07-10 10:49:39 -04:00
|
|
|
|
|
|
|
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;
|
2016-09-21 16:25:44 -04:00
|
|
|
void use_previous_layout ();
|
|
|
|
|
2016-09-16 09:39:28 -04:00
|
|
|
Push2Canvas* canvas() const { return _canvas; }
|
2016-07-10 10:49:39 -04:00
|
|
|
|
|
|
|
enum ModifierState {
|
|
|
|
None = 0,
|
|
|
|
ModShift = 0x1,
|
|
|
|
ModSelect = 0x2,
|
|
|
|
};
|
|
|
|
|
|
|
|
ModifierState modifier_state() const { return _modifier_state; }
|
|
|
|
|
|
|
|
Button* button_by_id (ButtonID);
|
2016-09-19 17:11:22 -04:00
|
|
|
static std::string button_name_by_id (ButtonID);
|
2016-07-10 10:49:39 -04:00
|
|
|
|
2016-09-21 16:25:44 -04:00
|
|
|
void strip_buttons_off ();
|
|
|
|
|
2016-07-10 10:49:39 -04:00
|
|
|
void write (const MidiByteArray&);
|
|
|
|
|
2016-09-22 00:05:01 -04:00
|
|
|
uint8_t get_color_index (ArdourCanvas::Color rgba);
|
|
|
|
ArdourCanvas::Color get_color (ColorName);
|
2016-07-10 15:22:16 -04:00
|
|
|
|
2016-08-25 19:57:02 -04:00
|
|
|
PressureMode pressure_mode () const { return _pressure_mode; }
|
|
|
|
void set_pressure_mode (PressureMode);
|
|
|
|
PBD::Signal1<void,PressureMode> PressureModeChange;
|
2016-09-16 09:39:28 -04:00
|
|
|
|
|
|
|
libusb_device_handle* usb_handle() const { return handle; }
|
|
|
|
|
2016-07-10 10:49:39 -04:00
|
|
|
private:
|
|
|
|
libusb_device_handle *handle;
|
2016-09-30 11:22:30 -04:00
|
|
|
bool in_use;
|
2016-07-10 10:49:39 -04:00
|
|
|
ModifierState _modifier_state;
|
|
|
|
|
|
|
|
void do_request (Push2Request*);
|
2016-09-30 11:22:30 -04:00
|
|
|
|
|
|
|
int begin_using_device ();
|
|
|
|
int stop_using_device ();
|
|
|
|
int device_acquire ();
|
|
|
|
void device_release ();
|
|
|
|
int ports_acquire ();
|
|
|
|
void ports_release ();
|
|
|
|
void run_event_loop ();
|
|
|
|
void stop_event_loop ();
|
2016-07-10 10:49:39 -04:00
|
|
|
|
2016-06-16 14:06:16 -04:00
|
|
|
void relax () {}
|
|
|
|
|
|
|
|
/* map of Buttons by CC */
|
|
|
|
typedef std::map<int,Button*> CCButtonMap;
|
|
|
|
CCButtonMap cc_button_map;
|
|
|
|
/* map of Buttons by ButtonID */
|
|
|
|
typedef std::map<ButtonID,Button*> IDButtonMap;
|
|
|
|
IDButtonMap id_button_map;
|
2016-06-17 15:51:16 -04:00
|
|
|
std::set<ButtonID> buttons_down;
|
|
|
|
std::set<ButtonID> consumed;
|
|
|
|
|
|
|
|
bool button_long_press_timeout (ButtonID id);
|
|
|
|
void start_press_timeout (Button&, ButtonID);
|
2016-06-16 14:06:16 -04:00
|
|
|
|
2016-06-17 09:32:18 -04:00
|
|
|
void init_buttons (bool startup);
|
2016-06-17 09:21:29 -04:00
|
|
|
void init_touch_strip ();
|
2016-06-17 00:15:55 -04:00
|
|
|
|
2016-09-22 11:27:21 -04:00
|
|
|
/* map of Pads by note number (the "fixed" note number sent by the
|
|
|
|
* hardware, not the note number generated if the pad is touched)
|
|
|
|
*/
|
2016-06-16 14:06:16 -04:00
|
|
|
typedef std::map<int,Pad*> NNPadMap;
|
|
|
|
NNPadMap nn_pad_map;
|
|
|
|
|
2016-09-22 11:27:21 -04:00
|
|
|
/* map of Pads by note number they generate (their "filtered" value)
|
|
|
|
*/
|
|
|
|
typedef std::multimap<int,Pad*> FNPadMap;
|
|
|
|
FNPadMap fn_pad_map;
|
|
|
|
|
2016-06-16 14:06:16 -04:00
|
|
|
void set_button_color (ButtonID, uint8_t color_index);
|
|
|
|
void set_button_state (ButtonID, LED::State);
|
|
|
|
void set_led_color (ButtonID, uint8_t color_index);
|
|
|
|
void set_led_state (ButtonID, LED::State);
|
|
|
|
|
|
|
|
void build_maps ();
|
2016-06-16 10:02:46 -04:00
|
|
|
|
2016-07-08 17:10:26 -04:00
|
|
|
// 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;
|
|
|
|
|
2016-06-16 17:45:41 -04:00
|
|
|
MIDI::Port* _input_port;
|
|
|
|
MIDI::Port* _output_port;
|
|
|
|
boost::shared_ptr<ARDOUR::Port> _async_in;
|
|
|
|
boost::shared_ptr<ARDOUR::Port> _async_out;
|
2016-06-16 10:02:46 -04:00
|
|
|
|
2016-06-16 14:06:16 -04:00
|
|
|
void connect_to_parser ();
|
|
|
|
void handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t);
|
|
|
|
void handle_midi_controller_message (MIDI::Parser&, MIDI::EventTwoBytes*);
|
|
|
|
void handle_midi_note_on_message (MIDI::Parser&, MIDI::EventTwoBytes*);
|
|
|
|
void handle_midi_note_off_message (MIDI::Parser&, MIDI::EventTwoBytes*);
|
|
|
|
void handle_midi_sysex (MIDI::Parser&, MIDI::byte *, size_t count);
|
|
|
|
|
2016-06-16 10:43:21 -04:00
|
|
|
bool midi_input_handler (Glib::IOCondition ioc, MIDI::Port* port);
|
2016-09-16 09:39:28 -04:00
|
|
|
|
2016-06-16 14:06:16 -04:00
|
|
|
void thread_init ();
|
|
|
|
|
|
|
|
PBD::ScopedConnectionList session_connections;
|
|
|
|
void connect_session_signals ();
|
|
|
|
void notify_record_state_changed ();
|
|
|
|
void notify_transport_state_changed ();
|
|
|
|
void notify_loop_state_changed ();
|
|
|
|
void notify_parameter_changed (std::string);
|
|
|
|
void notify_solo_active_changed (bool);
|
|
|
|
|
|
|
|
/* Button methods */
|
|
|
|
void button_play ();
|
|
|
|
void button_recenable ();
|
|
|
|
void button_up ();
|
|
|
|
void button_down ();
|
2016-06-16 17:45:41 -04:00
|
|
|
void button_right ();
|
|
|
|
void button_left ();
|
|
|
|
void button_metronome ();
|
|
|
|
void button_repeat ();
|
2016-07-11 13:13:04 -04:00
|
|
|
void button_mute ();
|
2016-06-16 23:31:51 -04:00
|
|
|
void button_solo ();
|
2016-07-11 13:13:04 -04:00
|
|
|
void button_solo_long_press ();
|
2016-06-17 00:15:55 -04:00
|
|
|
void button_fixed_length ();
|
|
|
|
void button_new ();
|
2016-06-17 01:29:00 -04:00
|
|
|
void button_browse ();
|
|
|
|
void button_clip ();
|
2016-06-17 01:59:01 -04:00
|
|
|
void button_undo ();
|
|
|
|
void button_fwd32t ();
|
|
|
|
void button_fwd32 ();
|
|
|
|
void button_fwd16t ();
|
|
|
|
void button_fwd16 ();
|
|
|
|
void button_fwd8t ();
|
|
|
|
void button_fwd8 ();
|
|
|
|
void button_fwd4t ();
|
|
|
|
void button_fwd4 ();
|
2016-06-17 15:51:16 -04:00
|
|
|
void button_add_track ();
|
|
|
|
void button_stop ();
|
2016-09-22 15:41:49 -04:00
|
|
|
void button_master ();
|
2016-09-22 17:28:25 -04:00
|
|
|
void button_quantize ();
|
|
|
|
void button_duplicate ();
|
2016-06-17 15:51:16 -04:00
|
|
|
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 ();
|
2016-06-17 18:54:13 -04:00
|
|
|
void button_page_left ();
|
|
|
|
void button_page_right ();
|
2016-07-06 23:49:07 -04:00
|
|
|
void button_octave_up ();
|
|
|
|
void button_octave_down ();
|
2016-07-09 23:26:02 -04:00
|
|
|
void button_layout_press ();
|
2016-07-10 08:37:45 -04:00
|
|
|
void button_scale_press ();
|
2016-07-10 13:02:42 -04:00
|
|
|
void button_mix_press ();
|
2016-06-17 15:51:16 -04:00
|
|
|
|
2016-07-10 10:49:39 -04:00
|
|
|
void button_upper (uint32_t n);
|
|
|
|
void button_lower (uint32_t n);
|
|
|
|
|
|
|
|
void button_upper_1 () { button_upper (0); }
|
|
|
|
void button_upper_2 () { button_upper (1); }
|
|
|
|
void button_upper_3 () { button_upper (2); }
|
|
|
|
void button_upper_4 () { button_upper (3); }
|
|
|
|
void button_upper_5 () { button_upper (4); }
|
|
|
|
void button_upper_6 () { button_upper (5); }
|
|
|
|
void button_upper_7 () { button_upper (6); }
|
|
|
|
void button_upper_8 () { button_upper (7); }
|
|
|
|
void button_lower_1 () { button_lower (0); }
|
|
|
|
void button_lower_2 () { button_lower (1); }
|
|
|
|
void button_lower_3 () { button_lower (2); }
|
|
|
|
void button_lower_4 () { button_lower (3); }
|
|
|
|
void button_lower_5 () { button_lower (4); }
|
|
|
|
void button_lower_6 () { button_lower (5); }
|
|
|
|
void button_lower_7 () { button_lower (6); }
|
|
|
|
void button_lower_8 () { button_lower (7); }
|
|
|
|
|
2016-06-17 15:51:16 -04:00
|
|
|
void start_shift ();
|
|
|
|
void end_shift ();
|
2016-06-16 22:51:30 -04:00
|
|
|
|
2016-07-10 10:49:39 -04:00
|
|
|
/* non-strip encoders */
|
2016-06-17 08:37:39 -04:00
|
|
|
|
|
|
|
void other_vpot (int, int);
|
2016-06-17 09:03:26 -04:00
|
|
|
void other_vpot_touch (int, bool);
|
2016-06-17 08:37:39 -04:00
|
|
|
|
2016-10-17 15:58:02 -04:00
|
|
|
/* special Stripable */
|
2016-07-10 10:49:39 -04:00
|
|
|
|
|
|
|
boost::shared_ptr<ARDOUR::Stripable> master;
|
|
|
|
|
2016-09-16 09:39:28 -04:00
|
|
|
sigc::connection vblank_connection;
|
|
|
|
bool vblank ();
|
2016-06-17 01:29:00 -04:00
|
|
|
|
2016-06-19 12:26:28 -04:00
|
|
|
void splash ();
|
|
|
|
ARDOUR::microseconds_t splash_start;
|
|
|
|
|
2016-09-16 09:39:28 -04:00
|
|
|
/* the canvas */
|
|
|
|
|
|
|
|
Push2Canvas* _canvas;
|
|
|
|
|
2016-07-10 10:49:39 -04:00
|
|
|
/* Layouts */
|
2016-06-17 01:29:00 -04:00
|
|
|
|
2016-07-10 10:49:39 -04:00
|
|
|
mutable Glib::Threads::Mutex layout_lock;
|
|
|
|
Push2Layout* _current_layout;
|
2016-09-21 16:25:44 -04:00
|
|
|
Push2Layout* _previous_layout;
|
2016-07-10 10:49:39 -04:00
|
|
|
Push2Layout* mix_layout;
|
|
|
|
Push2Layout* scale_layout;
|
2016-07-10 13:02:42 -04:00
|
|
|
Push2Layout* track_mix_layout;
|
2016-09-16 14:17:24 -04:00
|
|
|
Push2Layout* splash_layout;
|
2016-07-11 13:13:04 -04:00
|
|
|
void set_current_layout (Push2Layout*);
|
2016-06-20 08:31:33 -04:00
|
|
|
|
|
|
|
bool pad_filter (ARDOUR::MidiBuffer& in, ARDOUR::MidiBuffer& out) const;
|
2016-06-20 13:47:45 -04:00
|
|
|
|
2016-07-07 09:42:26 -04:00
|
|
|
boost::weak_ptr<ARDOUR::MidiTrack> current_pad_target;
|
2016-07-06 22:34:10 -04:00
|
|
|
|
|
|
|
PBD::ScopedConnection port_reg_connection;
|
|
|
|
void port_registration_handler ();
|
|
|
|
|
|
|
|
enum ConnectionState {
|
|
|
|
InputConnected = 0x1,
|
|
|
|
OutputConnected = 0x2
|
|
|
|
};
|
|
|
|
|
|
|
|
int connection_state;
|
|
|
|
bool connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool yn);
|
|
|
|
PBD::ScopedConnection port_connection;
|
2016-08-25 19:57:02 -04:00
|
|
|
void connected ();
|
2016-07-06 22:34:10 -04:00
|
|
|
|
|
|
|
/* GUI */
|
|
|
|
|
2016-07-07 00:10:27 -04:00
|
|
|
mutable P2GUI* gui;
|
2016-07-06 22:34:10 -04:00
|
|
|
void build_gui ();
|
|
|
|
|
2016-07-06 23:49:07 -04:00
|
|
|
/* pad mapping */
|
|
|
|
|
2016-07-10 10:49:39 -04:00
|
|
|
PBD::ScopedConnection selection_connection;
|
|
|
|
void stripable_selection_change (ARDOUR::StripableNotificationListPtr);
|
|
|
|
|
2016-07-07 16:28:15 -04:00
|
|
|
MusicalMode::Type _mode;
|
|
|
|
int _scale_root;
|
|
|
|
int _root_octave;
|
|
|
|
bool _in_key;
|
2016-07-07 15:53:19 -04:00
|
|
|
|
2016-07-06 23:49:07 -04:00
|
|
|
int octave_shift;
|
2016-07-09 23:26:02 -04:00
|
|
|
|
|
|
|
bool percussion;
|
|
|
|
void set_percussive_mode (bool);
|
2016-07-10 15:22:16 -04:00
|
|
|
|
2016-07-11 09:07:52 -04:00
|
|
|
/* color map (device side) */
|
2016-07-10 15:22:16 -04:00
|
|
|
|
2016-09-22 00:05:01 -04:00
|
|
|
typedef std::map<ArdourCanvas::Color,uint8_t> ColorMap;
|
2016-07-10 15:22:16 -04:00
|
|
|
typedef std::stack<uint8_t> ColorMapFreeList;
|
|
|
|
ColorMap color_map;
|
|
|
|
ColorMapFreeList color_map_free_list;
|
|
|
|
void build_color_map ();
|
2016-07-11 09:07:52 -04:00
|
|
|
|
|
|
|
/* our own colors */
|
|
|
|
|
2016-09-22 00:05:01 -04:00
|
|
|
typedef std::map<ColorName,ArdourCanvas::Color> Colors;
|
2016-07-11 09:07:52 -04:00
|
|
|
Colors colors;
|
|
|
|
void fill_color_table ();
|
2016-09-22 00:05:01 -04:00
|
|
|
void reset_pad_colors ();
|
2016-08-25 19:57:02 -04:00
|
|
|
|
|
|
|
PressureMode _pressure_mode;
|
|
|
|
void request_pressure_mode ();
|
2016-09-22 00:05:01 -04:00
|
|
|
|
|
|
|
uint8_t selection_color;
|
2016-09-22 11:47:34 -04:00
|
|
|
uint8_t contrast_color;
|
2016-09-28 12:28:38 -04:00
|
|
|
|
|
|
|
bool in_range_select;
|
2016-07-10 10:49:39 -04:00
|
|
|
};
|
2016-06-15 22:41:01 -04:00
|
|
|
|
|
|
|
} /* namespace */
|
|
|
|
|
|
|
|
#endif /* __ardour_push2_h__ */
|