From 58652f6268c9b27c8045c23e335ea4f48384c073 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 6 Nov 2023 12:33:36 -0700 Subject: [PATCH] launchpad pro: use "first fader" concept from lpx we control the CC number sent by launchpad faders, and 0x20 is too large because it causes the faders to overlap with some of the CC values sent by RHS pads. Parametize the first fader and use it everywhere --- libs/surfaces/launchpad_pro/lppro.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libs/surfaces/launchpad_pro/lppro.cc b/libs/surfaces/launchpad_pro/lppro.cc index 3c50fa8f22..d234cac54c 100644 --- a/libs/surfaces/launchpad_pro/lppro.cc +++ b/libs/surfaces/launchpad_pro/lppro.cc @@ -78,6 +78,7 @@ using namespace Gtkmm2ext; #define NOVATION 0x1235 #define LAUNCHPADPROMK3 0x0123 static const std::vector sysex_header ({ 0xf0, 0x00, 0x20, 0x29, 0x2, 0xe }); +static int first_fader = 0x9; const LaunchPadPro::PadID LaunchPadPro::all_pad_ids[] = { Shift, Left, Right, Session, Note, Chord, Custom, Sequencer, Projects, @@ -731,7 +732,7 @@ LaunchPadPro::handle_midi_controller_message (MIDI::Parser&, MIDI::EventTwoBytes if (_current_layout == Fader) { /* Trap fader move messages and act on them */ - if (ev->controller_number >= 0x20 && ev->controller_number < 0x28) { + if (ev->controller_number >= first_fader && ev->controller_number < first_fader+8) { fader_move (ev->controller_number, ev->value); return; } @@ -1935,7 +1936,7 @@ LaunchPadPro::setup_faders (FaderBank bank) msg.push_back (0); /* unipolar */ break; } - msg.push_back (0x20+n); /* CC number */ + msg.push_back (first_fader+n); /* CC number */ msg.push_back (random() % 127); /* color */ } @@ -1954,7 +1955,7 @@ LaunchPadPro::fader_move (int cc, int val) r = std::dynamic_pointer_cast (session->selection().first_selected_stripable()); break; default: - r = session->get_remote_nth_route (scroll_x_offset + (cc - 0x20)); + r = session->get_remote_nth_route (scroll_x_offset + (cc - first_fader)); break; } @@ -1978,7 +1979,7 @@ LaunchPadPro::fader_move (int cc, int val) } break; case SendFaders: - ac = r->send_level_controllable (scroll_x_offset + (cc - 0x20)); + ac = r->send_level_controllable (scroll_x_offset + (cc - first_fader)); if (ac) { session->set_control (ac, ARDOUR::slider_position_to_gain_with_max (val/127.0, ARDOUR::Config->get_max_gain()), PBD::Controllable::NoGroup); } @@ -2012,7 +2013,7 @@ LaunchPadPro::map_faders () std::shared_ptr ac; - msg[1] = 0x20 + n; + msg[1] = first_fader + n; if (!r) { switch (current_fader_bank) { @@ -2075,7 +2076,7 @@ LaunchPadPro::automation_control_change (int n, std::weak_ptr MIDI::byte msg[3]; msg[0] = 0xb4; - msg[1] = 0x20 + n; + msg[1] = first_fader + n; switch (current_fader_bank) { case VolumeFaders: