From cc7eca74534e3699d15721d9b4c9c9efed45567f Mon Sep 17 00:00:00 2001 From: Jan Lentfer Date: Sun, 9 Feb 2020 16:29:07 +0100 Subject: [PATCH] LCXL: Adopt pan knob behaviour * "left/right" changed in A6, adopt for this * add a pick_up_rev function to honour this --- libs/surfaces/launch_control_xl/controllers.cc | 5 +++-- libs/surfaces/launch_control_xl/launch_control_xl.cc | 7 +++++++ libs/surfaces/launch_control_xl/launch_control_xl.h | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libs/surfaces/launch_control_xl/controllers.cc b/libs/surfaces/launch_control_xl/controllers.cc index a25504b885..4e93656618 100644 --- a/libs/surfaces/launch_control_xl/controllers.cc +++ b/libs/surfaces/launch_control_xl/controllers.cc @@ -879,8 +879,9 @@ LaunchControlXL::knob_pan(uint8_t n) } - if (ac && check_pick_up(knob, ac)) { - ac->set_value ( ac->interface_to_internal( knob->value() / 127.0), PBD::Controllable::UseGroup ); + if (ac && check_pick_up_rev(knob, ac)) { + DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose ("knob->value: '%1'\n", (int) knob->value())); + ac->set_value (ac->interface_to_internal ((127 - knob->value()) / 127.0), PBD::Controllable::UseGroup); } } diff --git a/libs/surfaces/launch_control_xl/launch_control_xl.cc b/libs/surfaces/launch_control_xl/launch_control_xl.cc index f659ea685c..0fd5cca763 100644 --- a/libs/surfaces/launch_control_xl/launch_control_xl.cc +++ b/libs/surfaces/launch_control_xl/launch_control_xl.cc @@ -620,6 +620,13 @@ LaunchControlXL::check_pick_up(boost::shared_ptr controller, boost:: return ( abs( controller->value() / 127.0 - ac->internal_to_interface(ac->get_value()) ) < 0.007875 ); } +bool +LaunchControlXL::check_pick_up_rev (boost::shared_ptr controller, boost::shared_ptr ac) +{ + /* returns false until 127 minus the controller value matches with the current setting of the stripable's ac */ + return (abs ((127 - controller->value()) / 127.0 - ac->internal_to_interface (ac->get_value())) < 0.007875); +} + void LaunchControlXL::handle_midi_controller_message (MIDI::Parser& parser, MIDI::EventTwoBytes* ev, MIDI::channel_t chan) { diff --git a/libs/surfaces/launch_control_xl/launch_control_xl.h b/libs/surfaces/launch_control_xl/launch_control_xl.h index 166200aff3..af041a302c 100644 --- a/libs/surfaces/launch_control_xl/launch_control_xl.h +++ b/libs/surfaces/launch_control_xl/launch_control_xl.h @@ -496,6 +496,8 @@ private: void handle_button_message(boost::shared_ptr