launchpad pro: basics of pad/button handling, complete with cue launch and transport control
This commit is contained in:
parent
9438914aca
commit
2f9fd8e288
|
@ -127,9 +127,13 @@ LaunchPadPro::probe (std::string& i, std::string& o)
|
|||
|
||||
LaunchPadPro::LaunchPadPro (ARDOUR::Session& s)
|
||||
: MIDISurface (s, X_("Novation Launchpad Pro"), X_("Launchpad Pro"), true)
|
||||
, logo_color (4)
|
||||
, scroll_x_offset (0)
|
||||
, scroll_y_offset (0)
|
||||
, _daw_out_port (nullptr)
|
||||
, _gui (nullptr)
|
||||
, _current_layout (SessionLayout)
|
||||
, _shift_pressed (false)
|
||||
{
|
||||
run_event_loop ();
|
||||
port_setup ();
|
||||
|
@ -211,11 +215,11 @@ LaunchPadPro::begin_using_device ()
|
|||
asp->xthread().set_receive_handler (sigc::bind (sigc::mem_fun (this, &MIDISurface::midi_input_handler), _daw_in_port));
|
||||
asp->xthread().attach (main_loop()->get_context());
|
||||
|
||||
/* request current layout */
|
||||
MidiByteArray msg (sysex_header);
|
||||
msg.push_back (0x0);
|
||||
msg.push_back (0xf7);
|
||||
write (msg);
|
||||
light_logo ();
|
||||
|
||||
Glib::RefPtr<Glib::TimeoutSource> timeout = Glib::TimeoutSource::create (1000); // milliseconds
|
||||
timeout->connect (sigc::mem_fun (*this, &LaunchPadPro::light_logo));
|
||||
timeout->attach (main_loop()->get_context());
|
||||
|
||||
set_device_mode (DAW);
|
||||
set_layout (SessionLayout);
|
||||
|
@ -236,6 +240,7 @@ LaunchPadPro::stop_using_device ()
|
|||
return 0;
|
||||
}
|
||||
|
||||
all_pads_out ();
|
||||
set_device_mode (Standalone);
|
||||
|
||||
return MIDISurface::stop_using_device ();
|
||||
|
@ -325,61 +330,63 @@ LaunchPadPro::output_daw_port_name () const
|
|||
void
|
||||
LaunchPadPro::build_pad_map ()
|
||||
{
|
||||
#define EDGE_PAD(id) if (!(pad_map.insert (make_pair<int,Pad> ((id), Pad ((id)))).second)) abort()
|
||||
#define EDGE_PAD0(id) if (!(pad_map.insert (make_pair<int,Pad> ((id), Pad ((id), &LaunchPadPro::relax))).second)) abort()
|
||||
#define EDGE_PAD(id, press) if (!(pad_map.insert (make_pair<int,Pad> ((id), Pad ((id), (press)))).second)) abort()
|
||||
#define EDGE_PAD2(id, press, release) if (!(pad_map.insert (make_pair<int,Pad> ((id), Pad ((id), (press), (release)))).second)) abort()
|
||||
|
||||
EDGE_PAD (Shift);
|
||||
EDGE_PAD2 (Shift, &LaunchPadPro::shift_press, &LaunchPadPro::shift_release);
|
||||
|
||||
EDGE_PAD (Left);
|
||||
EDGE_PAD (Right);
|
||||
EDGE_PAD (Session);
|
||||
EDGE_PAD (Note);
|
||||
EDGE_PAD (Chord);
|
||||
EDGE_PAD (Custom);
|
||||
EDGE_PAD (Sequencer);
|
||||
EDGE_PAD (Projects);
|
||||
EDGE_PAD0 (Left);
|
||||
EDGE_PAD0 (Right);
|
||||
EDGE_PAD0 (Session);
|
||||
EDGE_PAD0 (Note);
|
||||
EDGE_PAD0 (Chord);
|
||||
EDGE_PAD0 (Custom);
|
||||
EDGE_PAD0 (Sequencer);
|
||||
EDGE_PAD0 (Projects);
|
||||
|
||||
EDGE_PAD (Patterns);
|
||||
EDGE_PAD (Steps);
|
||||
EDGE_PAD (PatternSettings);
|
||||
EDGE_PAD (Velocity);
|
||||
EDGE_PAD (Probability);
|
||||
EDGE_PAD (Mutation);
|
||||
EDGE_PAD (MicroStep);
|
||||
EDGE_PAD (PrintToClip);
|
||||
EDGE_PAD (Patterns, &LaunchPadPro::patterns_press);
|
||||
EDGE_PAD (Steps, &LaunchPadPro::steps_press);
|
||||
EDGE_PAD (PatternSettings, &LaunchPadPro::pattern_settings_press);
|
||||
EDGE_PAD (Velocity, &LaunchPadPro::velocity_press);
|
||||
EDGE_PAD (Probability, &LaunchPadPro::probability_press);
|
||||
EDGE_PAD (Mutation, &LaunchPadPro::mutation_press);
|
||||
EDGE_PAD (MicroStep, &LaunchPadPro::microstep_press);
|
||||
EDGE_PAD (PrintToClip, &LaunchPadPro::print_to_clip_press);
|
||||
|
||||
EDGE_PAD (StopClip);
|
||||
EDGE_PAD (Device);
|
||||
EDGE_PAD (Sends);
|
||||
EDGE_PAD (Pan);
|
||||
EDGE_PAD (Volume);
|
||||
EDGE_PAD (Solo);
|
||||
EDGE_PAD (Mute);
|
||||
EDGE_PAD (RecordArm);
|
||||
EDGE_PAD0 (StopClip);
|
||||
EDGE_PAD0 (Device);
|
||||
EDGE_PAD0 (Sends);
|
||||
EDGE_PAD0 (Pan);
|
||||
EDGE_PAD0 (Volume);
|
||||
EDGE_PAD0 (Solo);
|
||||
EDGE_PAD0 (Mute);
|
||||
EDGE_PAD0 (RecordArm);
|
||||
|
||||
EDGE_PAD (CaptureMIDI);
|
||||
EDGE_PAD (Play);
|
||||
EDGE_PAD (FixedLength);
|
||||
EDGE_PAD (Quantize);
|
||||
EDGE_PAD (Duplicate);
|
||||
EDGE_PAD (Clear);
|
||||
EDGE_PAD (Down);
|
||||
EDGE_PAD (Up);
|
||||
EDGE_PAD0 (CaptureMIDI);
|
||||
EDGE_PAD (Play, &LaunchPadPro::play_press);
|
||||
EDGE_PAD0 (FixedLength);
|
||||
EDGE_PAD0 (Quantize);
|
||||
EDGE_PAD0 (Duplicate);
|
||||
EDGE_PAD0 (Clear);
|
||||
EDGE_PAD0 (Down);
|
||||
EDGE_PAD0 (Up);
|
||||
|
||||
EDGE_PAD (Lower1);
|
||||
EDGE_PAD (Lower2);
|
||||
EDGE_PAD (Lower3);
|
||||
EDGE_PAD (Lower4);
|
||||
EDGE_PAD (Lower5);
|
||||
EDGE_PAD (Lower6);
|
||||
EDGE_PAD (Lower7);
|
||||
EDGE_PAD (Lower8);
|
||||
EDGE_PAD0 (Lower1);
|
||||
EDGE_PAD0 (Lower2);
|
||||
EDGE_PAD0 (Lower3);
|
||||
EDGE_PAD0 (Lower4);
|
||||
EDGE_PAD0 (Lower5);
|
||||
EDGE_PAD0 (Lower6);
|
||||
EDGE_PAD0 (Lower7);
|
||||
EDGE_PAD0 (Lower8);
|
||||
|
||||
/* Now add the 8x8 central pad grid */
|
||||
|
||||
for (int row = 0; row < 8; ++row) {
|
||||
for (int col = 0; col < 8; ++col) {
|
||||
int pid = (11 + (row * 10)) + col;
|
||||
std::pair<int,Pad> p (pid, Pad (pid, col, row));
|
||||
std::pair<int,Pad> p (pid, Pad (pid, col, row, &LaunchPadPro::relax));
|
||||
if (!pad_map.insert (p).second) abort();
|
||||
}
|
||||
}
|
||||
|
@ -388,6 +395,40 @@ LaunchPadPro::build_pad_map ()
|
|||
assert (pad_map.size() == (64 + (5 * 8) + 1));
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::all_pads_out ()
|
||||
{
|
||||
MIDI::byte msg[3];
|
||||
msg[0] = 0x90;
|
||||
msg[2] = 0x0;
|
||||
|
||||
for (auto const & p : pad_map) {
|
||||
msg[1] = p.second.id;
|
||||
daw_write (msg, 3);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
LaunchPadPro::light_logo ()
|
||||
{
|
||||
MIDI::byte msg[3];
|
||||
|
||||
msg[0] = 0x90;
|
||||
msg[1] = 0x63;
|
||||
|
||||
logo_color++;
|
||||
|
||||
if (logo_color > 60) {
|
||||
logo_color = 4;
|
||||
}
|
||||
|
||||
msg[2] = logo_color;
|
||||
|
||||
daw_write (msg, 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
LaunchPadPro::Pad*
|
||||
LaunchPadPro::pad_by_id (int pid)
|
||||
{
|
||||
|
@ -515,9 +556,14 @@ LaunchPadPro::set_device_mode (DeviceMode m)
|
|||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::handle_midi_sysex (MIDI::Parser&, MIDI::byte* raw_bytes, size_t sz)
|
||||
LaunchPadPro::handle_midi_sysex (MIDI::Parser& parser, MIDI::byte* raw_bytes, size_t sz)
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::Launchpad, string_compose ("Sysex, %1 bytes\n", sz));
|
||||
DEBUG_TRACE (DEBUG::Launchpad, string_compose ("Sysex, %1 bytes parser %2\n", sz, &parser));
|
||||
|
||||
if (&parser != _daw_in_port->parser()) {
|
||||
DEBUG_TRACE (DEBUG::Launchpad, "sysex from non-DAW port, ignored\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sz < sysex_header.size() + 1) {
|
||||
return;
|
||||
|
@ -535,7 +581,7 @@ LaunchPadPro::handle_midi_sysex (MIDI::Parser&, MIDI::byte* raw_bytes, size_t sz
|
|||
|
||||
if (raw_bytes[1] < num_layouts) {
|
||||
_current_layout = AllLayouts[raw_bytes[1]];
|
||||
std::cerr << "Current layout = " << _current_layout << std::endl;
|
||||
std::cerr << "Current layout = " << _current_layout << " from " << (int) raw_bytes[1] << std::endl;
|
||||
} else {
|
||||
std::cerr << "ignore illegal layout index " << (int) raw_bytes[1] << std::endl;
|
||||
}
|
||||
|
@ -560,6 +606,17 @@ LaunchPadPro::handle_midi_controller_message (MIDI::Parser&, MIDI::EventTwoBytes
|
|||
}
|
||||
|
||||
Pad& pad (p->second);
|
||||
set<int>::iterator c = consumed.find (pad.id);
|
||||
|
||||
if (c == consumed.end()) {
|
||||
if (ev->value) {
|
||||
(this->*pad.on_press) (pad);
|
||||
} else {
|
||||
(this->*pad.on_release) (pad);
|
||||
}
|
||||
} else {
|
||||
consumed.erase (c);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -582,6 +639,7 @@ LaunchPadPro::handle_midi_note_on_message (MIDI::Parser& parser, MIDI::EventTwoB
|
|||
}
|
||||
|
||||
Pad& pad (p->second);
|
||||
(this->*pad.on_press) (pad);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -599,6 +657,17 @@ LaunchPadPro::handle_midi_note_off_message (MIDI::Parser&, MIDI::EventTwoBytes*
|
|||
}
|
||||
|
||||
Pad& pad (p->second);
|
||||
|
||||
set<int>::iterator c = consumed.find (pad.id);
|
||||
|
||||
if (c == consumed.end()) {
|
||||
(this->*pad.on_release) (pad);
|
||||
|
||||
} else {
|
||||
/* used for long press */
|
||||
consumed.erase (c);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -651,7 +720,7 @@ LaunchPadPro::ports_acquire ()
|
|||
_daw_out = AudioEngine::instance()->register_output_port (DataType::MIDI, string_compose (X_("%1 daw out"), port_name_prefix), true);
|
||||
}
|
||||
if (_daw_out) {
|
||||
_daw_out_port = std::dynamic_pointer_cast<AsyncMIDIPort>(_async_out).get();
|
||||
_daw_out_port = std::dynamic_pointer_cast<AsyncMIDIPort>(_daw_out).get();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -685,7 +754,6 @@ LaunchPadPro::ports_release ()
|
|||
void
|
||||
LaunchPadPro::daw_write (const MidiByteArray& data)
|
||||
{
|
||||
/* immediate delivery */
|
||||
_daw_out_port->write (&data[0], data.size(), 0);
|
||||
}
|
||||
|
||||
|
@ -817,3 +885,304 @@ LaunchPadPro::pad_filter (MidiBuffer& in, MidiBuffer& out) const
|
|||
|
||||
return matched;
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::start_press_timeout (Pad& pad)
|
||||
{
|
||||
Glib::RefPtr<Glib::TimeoutSource> timeout = Glib::TimeoutSource::create (500); // milliseconds
|
||||
pad.timeout_connection = timeout->connect (sigc::bind (sigc::mem_fun (*this, &LaunchPadPro::long_press_timeout), pad.id));
|
||||
timeout->attach (main_loop()->get_context());
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::maybe_start_press_timeout (Pad& pad)
|
||||
{
|
||||
if (pad.on_long_press == &LaunchPadPro::relax) {
|
||||
return;
|
||||
}
|
||||
start_press_timeout (pad);
|
||||
}
|
||||
|
||||
bool
|
||||
LaunchPadPro::long_press_timeout (int pad_id)
|
||||
{
|
||||
PadMap::iterator p = pad_map.find (pad_id);
|
||||
if (p == pad_map.end()) {
|
||||
/* impossible */
|
||||
return false;
|
||||
}
|
||||
Pad& pad (p->second);
|
||||
(this->*pad.on_long_press) (pad);
|
||||
|
||||
/* Pad was used for long press, do not invoke release action */
|
||||
consumed.insert (pad.id);
|
||||
|
||||
return false; /* don't get called again */
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::shift_press (Pad& pad)
|
||||
{
|
||||
_shift_pressed = true;
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::shift_release (Pad& pad)
|
||||
{
|
||||
_shift_pressed = false;
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::left_press (Pad& pad)
|
||||
{
|
||||
if (scroll_x_offset) {
|
||||
scroll_x_offset--;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::right_press (Pad& pad)
|
||||
{
|
||||
scroll_x_offset++;
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::session_press (Pad& pad)
|
||||
{
|
||||
/* handled by device */
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::note_press (Pad& pad)
|
||||
{
|
||||
/* handled by device */
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::chord_press (Pad& pad)
|
||||
{
|
||||
/* handled by device */
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::custom_press (Pad& pad)
|
||||
{
|
||||
/* handled by device */
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::sequencer_press (Pad& pad)
|
||||
{
|
||||
/* handled by device */
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::projects_press (Pad& pad)
|
||||
{
|
||||
/* handled by device */
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::patterns_press (Pad& pad)
|
||||
{
|
||||
if (_current_layout == SessionLayout) {
|
||||
session->trigger_cue_row (0 + scroll_y_offset);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::steps_press (Pad& pad)
|
||||
{
|
||||
if (_current_layout == SessionLayout) {
|
||||
session->trigger_cue_row (1 + scroll_y_offset);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::pattern_settings_press (Pad& pad)
|
||||
{
|
||||
if (_current_layout == SessionLayout) {
|
||||
session->trigger_cue_row (2 + scroll_y_offset);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::velocity_press (Pad& pad)
|
||||
{
|
||||
if (_current_layout == SessionLayout) {
|
||||
session->trigger_cue_row (3 + scroll_y_offset);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::probability_press (Pad& pad)
|
||||
{
|
||||
if (_current_layout == SessionLayout) {
|
||||
session->trigger_cue_row (4 + scroll_y_offset);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::mutation_press (Pad& pad)
|
||||
{
|
||||
if (_current_layout == SessionLayout) {
|
||||
session->trigger_cue_row (5 + scroll_y_offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LaunchPadPro::microstep_press (Pad& pad)
|
||||
{
|
||||
if (_current_layout == SessionLayout) {
|
||||
session->trigger_cue_row (6 + scroll_y_offset);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::print_to_clip_press (Pad& pad)
|
||||
{
|
||||
if (_current_layout == SessionLayout) {
|
||||
session->trigger_cue_row (7 + scroll_y_offset);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::stop_clip_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::device_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::sends_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::pan_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::volume_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::solo_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::mute_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::record_arm_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::capture_midi_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::play_press (Pad& pad)
|
||||
{
|
||||
MIDI::byte velocity;
|
||||
if (session->transport_rolling()) {
|
||||
velocity = 17;
|
||||
} else {
|
||||
velocity = 21;
|
||||
}
|
||||
|
||||
toggle_roll (false, true);
|
||||
|
||||
MIDI::byte msg[3];
|
||||
|
||||
msg[0] = 0x90;
|
||||
msg[1] = pad.id;
|
||||
msg[2] = velocity;
|
||||
|
||||
daw_write (msg, 3);
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::fixed_length_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::quantize_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::duplicate_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::clear_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::down_press (Pad& pad)
|
||||
{
|
||||
if (scroll_y_offset) {
|
||||
scroll_y_offset--;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::up_press (Pad& pad)
|
||||
{
|
||||
scroll_y_offset++;
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::lower1_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::lower2_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::lower3_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::lower4_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::lower5_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::lower6_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::lower7_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LaunchPadPro::lower8_press (Pad& pad)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -110,9 +110,14 @@ class LaunchPadPro : public MIDISurface
|
|||
Lower5 = 0x69,
|
||||
Lower6 = 0x6a,
|
||||
Lower7 = 0x6b,
|
||||
Lower8 = 0x6c
|
||||
Lower8 = 0x6c,
|
||||
/* Logo */
|
||||
Logo = 0x63
|
||||
};
|
||||
|
||||
bool light_logo();
|
||||
void all_pads_out ();
|
||||
|
||||
static const PadID all_pad_ids[];
|
||||
|
||||
LaunchPadPro (ARDOUR::Session&);
|
||||
|
@ -167,34 +172,34 @@ class LaunchPadPro : public MIDISurface
|
|||
|
||||
struct Pad {
|
||||
|
||||
enum WhenPressed {
|
||||
Nothing,
|
||||
FlashOn,
|
||||
FlashOff,
|
||||
};
|
||||
|
||||
enum ColorMode {
|
||||
Static = 0x0,
|
||||
Flashing = 0x1,
|
||||
Pulsing = 0x2
|
||||
};
|
||||
|
||||
Pad (PadID pid)
|
||||
typedef void (LaunchPadPro::*PadMethod)(Pad&);
|
||||
|
||||
Pad (PadID pid, PadMethod press_method, PadMethod release_method = &LaunchPadPro::relax, PadMethod long_press_method = &LaunchPadPro::relax)
|
||||
: id (pid)
|
||||
, x (-1)
|
||||
, y (-1)
|
||||
, do_when_pressed (FlashOn)
|
||||
, on_press (press_method)
|
||||
, on_release (release_method)
|
||||
, on_long_press (long_press_method)
|
||||
, filtered (false)
|
||||
, perma_color (0)
|
||||
, color (0)
|
||||
, mode (Static)
|
||||
{}
|
||||
|
||||
Pad (int pid, int xx, int yy)
|
||||
Pad (int pid, int xx, int yy, PadMethod press_method, PadMethod release_method = &LaunchPadPro::relax, PadMethod long_press_method = &LaunchPadPro::relax)
|
||||
: id (pid)
|
||||
, x (xx)
|
||||
, y (yy)
|
||||
, do_when_pressed (FlashOn)
|
||||
, on_press (press_method)
|
||||
, on_release (release_method)
|
||||
, on_long_press (long_press_method)
|
||||
, filtered (true)
|
||||
, perma_color (0)
|
||||
, color (0)
|
||||
|
@ -207,23 +212,32 @@ class LaunchPadPro : public MIDISurface
|
|||
}
|
||||
void off() { set (0, Static); }
|
||||
|
||||
MidiByteArray state_msg () const { return MidiByteArray (3, 0x90|mode, id, color); }
|
||||
|
||||
/* This returns a negative value for edge pads */
|
||||
int coord () const { return (y * 8) + x; }
|
||||
/* Just an alias, really. */
|
||||
int note_number() const { return id; }
|
||||
MIDI::byte status_byte() const { if (x < 0) return 0xb0; return 0x90; }
|
||||
bool is_pad () const { return x >= 0; }
|
||||
bool is_button () const { return x < 0; }
|
||||
|
||||
MidiByteArray state_msg () const { return MidiByteArray (3, status_byte()|mode, id, color); }
|
||||
|
||||
int id;
|
||||
int x;
|
||||
int y;
|
||||
int do_when_pressed;
|
||||
PadMethod on_press;
|
||||
PadMethod on_release;
|
||||
PadMethod on_long_press;
|
||||
int filtered;
|
||||
int perma_color;
|
||||
int color;
|
||||
ColorMode mode;
|
||||
sigc::connection timeout_connection;
|
||||
};
|
||||
|
||||
void relax (Pad& p) {}
|
||||
|
||||
std::set<int> consumed;
|
||||
|
||||
MIDI::byte logo_color;
|
||||
|
||||
int scroll_x_offset;
|
||||
int scroll_y_offset;
|
||||
typedef std::pair<int32_t,int32_t> StripableSlot;
|
||||
|
@ -287,6 +301,137 @@ class LaunchPadPro : public MIDISurface
|
|||
Layout _current_layout;
|
||||
|
||||
bool pad_filter (ARDOUR::MidiBuffer& in, ARDOUR::MidiBuffer& out) const;
|
||||
|
||||
void maybe_start_press_timeout (Pad& pad);
|
||||
void start_press_timeout (Pad& pad);
|
||||
bool long_press_timeout (int pad_id);
|
||||
|
||||
bool _shift_pressed;
|
||||
|
||||
/* named pad methods */
|
||||
void shift_press (Pad&);
|
||||
void shift_release (Pad&);
|
||||
void shift_long_press (Pad&) {}
|
||||
void left_press (Pad&);
|
||||
void left_release (Pad&) {}
|
||||
void left_long_press (Pad&) {}
|
||||
void right_press (Pad&);
|
||||
void right_release (Pad&) {}
|
||||
void right_long_press (Pad&) {}
|
||||
void session_press (Pad&);
|
||||
void session_release (Pad&) {}
|
||||
void session_long_press (Pad&) {}
|
||||
void note_press (Pad&);
|
||||
void note_release (Pad&) {}
|
||||
void note_long_press (Pad&) {}
|
||||
void chord_press (Pad&);
|
||||
void chord_release (Pad&) {}
|
||||
void chord_long_press (Pad&) {}
|
||||
void custom_press (Pad&);
|
||||
void custom_release (Pad&) {}
|
||||
void custom_long_press (Pad&) {}
|
||||
void sequencer_press (Pad&);
|
||||
void sequencer_release (Pad&) {}
|
||||
void sequencer_long_press (Pad&) {}
|
||||
void projects_press (Pad&);
|
||||
void projects_release (Pad&) {}
|
||||
void projects_long_press (Pad&) {}
|
||||
void patterns_press (Pad&);
|
||||
void patterns_release (Pad&) {}
|
||||
void patterns_long_press (Pad&) {}
|
||||
void steps_press (Pad&);
|
||||
void steps_release (Pad&) {}
|
||||
void steps_long_press (Pad&) {}
|
||||
void pattern_settings_press (Pad&);
|
||||
void pattern_settings_release (Pad&) {}
|
||||
void pattern_settings_long_press (Pad&) {}
|
||||
void velocity_press (Pad&);
|
||||
void velocity_release (Pad&) {}
|
||||
void velocity_long_press (Pad&) {}
|
||||
void probability_press (Pad&);
|
||||
void probability_release (Pad&) {}
|
||||
void probability_long_press (Pad&) {}
|
||||
void mutation_press (Pad&);
|
||||
void mutation_release (Pad&) {}
|
||||
void mutation_long_press (Pad&) {}
|
||||
void microstep_press (Pad&);
|
||||
void microstep_release (Pad&) {}
|
||||
void microstep_long_press (Pad&) {}
|
||||
void print_to_clip_press (Pad&);
|
||||
void print_to_clip_release (Pad&) {}
|
||||
void print_to_clip_long_press (Pad&) {}
|
||||
void stop_clip_press (Pad&);
|
||||
void stop_clip_release (Pad&) {}
|
||||
void stop_clip_long_press (Pad&) {}
|
||||
void device_press (Pad&);
|
||||
void device_release (Pad&) {}
|
||||
void device_long_press (Pad&) {}
|
||||
void sends_press (Pad&);
|
||||
void sends_release (Pad&) {}
|
||||
void sends_long_press (Pad&) {}
|
||||
void pan_press (Pad&);
|
||||
void pan_release (Pad&) {}
|
||||
void pan_long_press (Pad&) {}
|
||||
void volume_press (Pad&);
|
||||
void volume_release (Pad&) {}
|
||||
void volume_long_press (Pad&) {}
|
||||
void solo_press (Pad&);
|
||||
void solo_release (Pad&) {}
|
||||
void solo_long_press (Pad&) {}
|
||||
void mute_press (Pad&);
|
||||
void mute_release (Pad&) {}
|
||||
void mute_long_press (Pad&) {}
|
||||
void record_arm_press (Pad&);
|
||||
void record_arm_release (Pad&) {}
|
||||
void record_arm_long_press (Pad&) {}
|
||||
void capture_midi_press (Pad&);
|
||||
void capture_midi_release (Pad&) {}
|
||||
void capture_midi_long_press (Pad&) {}
|
||||
void play_press (Pad&);
|
||||
void play_release (Pad&) {}
|
||||
void play_long_press (Pad&) {}
|
||||
void fixed_length_press (Pad&);
|
||||
void fixed_length_release (Pad&) {}
|
||||
void fixed_length_long_press (Pad&) {}
|
||||
void quantize_press (Pad&);
|
||||
void quantize_release (Pad&) {}
|
||||
void quantize_long_press (Pad&) {}
|
||||
void duplicate_press (Pad&);
|
||||
void duplicate_release (Pad&) {}
|
||||
void duplicate_long_press (Pad&) {}
|
||||
void clear_press (Pad&);
|
||||
void clear_release (Pad&) {}
|
||||
void clear_long_press (Pad&) {}
|
||||
void down_press (Pad&);
|
||||
void down_release (Pad&) {}
|
||||
void down_long_press (Pad&) {}
|
||||
void up_press (Pad&);
|
||||
void up_release (Pad&) {}
|
||||
void up_long_press (Pad&) {}
|
||||
void lower1_press (Pad&);
|
||||
void lower1_release (Pad&) {}
|
||||
void lower1_long_press (Pad&) {}
|
||||
void lower2_press (Pad&);
|
||||
void lower2_release (Pad&) {}
|
||||
void lower2_long_press (Pad&) {}
|
||||
void lower3_press (Pad&);
|
||||
void lower3_release (Pad&) {}
|
||||
void lower3_long_press (Pad&) {}
|
||||
void lower4_press (Pad&);
|
||||
void lower4_release (Pad&) {}
|
||||
void lower4_long_press (Pad&) {}
|
||||
void lower5_press (Pad&);
|
||||
void lower5_release (Pad&) {}
|
||||
void lower5_long_press (Pad&) {}
|
||||
void lower6_press (Pad&);
|
||||
void lower6_release (Pad&) {}
|
||||
void lower6_long_press (Pad&) {}
|
||||
void lower7_press (Pad&);
|
||||
void lower7_release (Pad&) {}
|
||||
void lower7_long_press (Pad&) {}
|
||||
void lower8_press (Pad&);
|
||||
void lower8_release (Pad&) {}
|
||||
void lower8_long_press (Pad&) {}
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
|
|
Loading…
Reference in New Issue
Block a user