From 740e075803886fe12c3662a28ba596844efb4446 Mon Sep 17 00:00:00 2001 From: Térence Clastres Date: Thu, 9 Aug 2018 22:13:14 +0200 Subject: Turn off button led if it doesn't control a stripable --- libs/surfaces/launch_control_xl/controllers.cc | 34 +++++++++++----------- .../launch_control_xl/launch_control_xl.cc | 6 ++-- 2 files changed, 19 insertions(+), 21 deletions(-) (limited to 'libs') diff --git a/libs/surfaces/launch_control_xl/controllers.cc b/libs/surfaces/launch_control_xl/controllers.cc index 7729d0589f..de9e0aa416 100644 --- a/libs/surfaces/launch_control_xl/controllers.cc +++ b/libs/surfaces/launch_control_xl/controllers.cc @@ -282,23 +282,23 @@ LaunchControlXL::track_button_by_number(uint8_t n, uint8_t first, uint8_t middle void LaunchControlXL::button_track_focus(uint8_t n) { - if (!stripable[n]) { - return; - } - TrackButton* b = focus_button_by_number(n); - if (b == 0) { + if (!b) { return; } - if ( stripable[n]->is_selected() ) { - b->set_color(AmberFull); + if (stripable[n]) { + if ( stripable[n]->is_selected() ) { + b->set_color(AmberFull); + } else { + b->set_color(AmberLow); + } } else { - b->set_color(AmberLow); + b->set_color(Off); } - write (b->state_msg()); + write (b->state_msg()); } boost::shared_ptr @@ -330,12 +330,12 @@ LaunchControlXL::update_track_control_led(uint8_t n) { TrackButton* b = control_button_by_number(n); - if (!stripable[n] || !b) { + if (!b) { return; } - boost::shared_ptr ac = get_ac_by_state(n); - + if (stripable[n]) { + boost::shared_ptr ac = get_ac_by_state(n); switch(track_mode()) { case TrackMute: @@ -345,7 +345,6 @@ LaunchControlXL::update_track_control_led(uint8_t n) b->set_color(AmberLow); } break; - case TrackSolo: if (ac && stripable[n] != master ) { if (ac->get_value()) { @@ -357,7 +356,6 @@ LaunchControlXL::update_track_control_led(uint8_t n) b->set_color(Off); } break; - case TrackRecord: if (ac) { if (ac->get_value()) { @@ -373,9 +371,11 @@ LaunchControlXL::update_track_control_led(uint8_t n) default: break; } - if (ac) { - write (b->state_msg()); - } + } else { + b->set_color(Off); + } + + write (b->state_msg()); } void diff --git a/libs/surfaces/launch_control_xl/launch_control_xl.cc b/libs/surfaces/launch_control_xl/launch_control_xl.cc index 699e7a84b5..0881d0647e 100644 --- a/libs/surfaces/launch_control_xl/launch_control_xl.cc +++ b/libs/surfaces/launch_control_xl/launch_control_xl.cc @@ -863,11 +863,9 @@ LaunchControlXL::switch_bank (uint32_t base) if (stripable[n]->rec_enable_control()) { stripable[n]->rec_enable_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::rec_changed, this, n), lcxl); } - - - button_track_focus(n); - button_track_mode(track_mode()); } + button_track_focus(n); + button_track_mode(track_mode()); } } -- cgit v1.2.3