lppro: momentary mode for all fader layouts

This commit is contained in:
Paul Davis 2023-08-23 20:12:40 -06:00
parent ee0d5cfc40
commit 75802cc47b
2 changed files with 34 additions and 7 deletions

View File

@ -141,6 +141,8 @@ LaunchPadPro::LaunchPadPro (ARDOUR::Session& s)
, _shift_pressed (false)
, did_session_display (false)
, current_fader_bank (VolumeFaders)
, revert_layout_on_fader_release (false)
, pre_fader_layout (SessionLayout)
{
run_event_loop ();
port_setup ();
@ -407,10 +409,10 @@ LaunchPadPro::build_pad_map ()
BUTTON (PrintToClip, &LaunchPadPro::print_to_clip_press);
BUTTON (StopClip, &LaunchPadPro::stop_clip_press);
BUTTON (Device, &LaunchPadPro::device_press);
BUTTON (Sends, &LaunchPadPro::sends_press);
BUTTON (Pan, &LaunchPadPro::pan_press);
BUTTON (Volume, &LaunchPadPro::volume_press);
BUTTON3 (Device, &LaunchPadPro::device_press, &LaunchPadPro::fader_long_press, &LaunchPadPro::fader_release);
BUTTON3 (Sends, &LaunchPadPro::sends_press, &LaunchPadPro::fader_long_press, &LaunchPadPro::fader_release);
BUTTON3 (Pan, &LaunchPadPro::pan_press, &LaunchPadPro::fader_long_press, &LaunchPadPro::fader_release);
BUTTON3 (Volume, &LaunchPadPro::volume_press, &LaunchPadPro::fader_long_press, &LaunchPadPro::fader_release);
BUTTON2 (Solo, &LaunchPadPro::solo_press, &LaunchPadPro::solo_long_press);
BUTTON (Mute, &LaunchPadPro::mute_press);
BUTTON (RecordArm, &LaunchPadPro::record_arm_press);
@ -554,6 +556,7 @@ LaunchPadPro::set_layout (Layout l, int page)
daw_write (msg);
if (l == Fader) {
pre_fader_layout = _current_layout;
current_fader_bank = (FaderBank) page;
map_faders ();
}
@ -1116,10 +1119,8 @@ LaunchPadPro::long_press_timeout (int pad_id)
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);
(this->*pad.on_long_press) (pad);
return false; /* don't get called again */
}
@ -1259,6 +1260,23 @@ LaunchPadPro::stop_clip_press (Pad& pad)
session->trigger_stop_all (_shift_pressed);
}
void
LaunchPadPro::fader_long_press (Pad&)
{
std::cerr << "fader long press\n";
revert_layout_on_fader_release = true;
}
void
LaunchPadPro::fader_release (Pad&)
{
std::cerr << "fader rel " << revert_layout_on_fader_release << std::endl;
if (revert_layout_on_fader_release) {
set_layout (pre_fader_layout);
revert_layout_on_fader_release = false;
}
}
void
LaunchPadPro::device_press (Pad& pad)
{
@ -1320,6 +1338,8 @@ void
LaunchPadPro::solo_long_press (Pad& pad)
{
cancel_all_solo ();
/* Pad was used for long press, do not invoke release action */
consumed.insert (pad.id);
}
void
@ -1477,6 +1497,8 @@ LaunchPadPro::pad_long_press (Pad& pad)
{
DEBUG_TRACE (DEBUG::Launchpad, string_compose ("pad long press on %1, %2 => %3\n", pad.x, pad.y, pad.id));
session->unbang_trigger_at (pad.x, pad.y);
/* Pad was used for long press, do not invoke release action */
consumed.insert (pad.id);
}
void

View File

@ -430,6 +430,9 @@ class LaunchPadPro : public MIDISurface
void lower8_release (Pad&) {}
void lower8_long_press (Pad&) {}
void fader_long_press (Pad&);
void fader_release (Pad&);
void pad_press (Pad&);
void pad_long_press (Pad&);
@ -454,6 +457,8 @@ class LaunchPadPro : public MIDISurface
void automation_control_change (int n, std::weak_ptr<ARDOUR::AutomationControl>);
PBD::ScopedConnectionList control_connections;
FaderBank current_fader_bank;
bool revert_layout_on_fader_release;
Layout pre_fader_layout;
};