Turn off button led if it doesn't control a stripable

This commit is contained in:
Térence Clastres 2018-08-09 22:13:14 +02:00
parent 5276a9941b
commit 740e075803
2 changed files with 19 additions and 21 deletions

View file

@ -282,23 +282,23 @@ LaunchControlXL::track_button_by_number(uint8_t n, uint8_t first, uint8_t middle
void void
LaunchControlXL::button_track_focus(uint8_t n) LaunchControlXL::button_track_focus(uint8_t n)
{ {
if (!stripable[n]) {
return;
}
TrackButton* b = focus_button_by_number(n); TrackButton* b = focus_button_by_number(n);
if (b == 0) { if (!b) {
return; return;
} }
if ( stripable[n]->is_selected() ) { if (stripable[n]) {
b->set_color(AmberFull); if ( stripable[n]->is_selected() ) {
b->set_color(AmberFull);
} else {
b->set_color(AmberLow);
}
} else { } else {
b->set_color(AmberLow); b->set_color(Off);
} }
write (b->state_msg());
write (b->state_msg());
} }
boost::shared_ptr<AutomationControl> boost::shared_ptr<AutomationControl>
@ -330,12 +330,12 @@ LaunchControlXL::update_track_control_led(uint8_t n)
{ {
TrackButton* b = control_button_by_number(n); TrackButton* b = control_button_by_number(n);
if (!stripable[n] || !b) { if (!b) {
return; return;
} }
boost::shared_ptr<AutomationControl> ac = get_ac_by_state(n); if (stripable[n]) {
boost::shared_ptr<AutomationControl> ac = get_ac_by_state(n);
switch(track_mode()) { switch(track_mode()) {
case TrackMute: case TrackMute:
@ -345,7 +345,6 @@ LaunchControlXL::update_track_control_led(uint8_t n)
b->set_color(AmberLow); b->set_color(AmberLow);
} }
break; break;
case TrackSolo: case TrackSolo:
if (ac && stripable[n] != master ) { if (ac && stripable[n] != master ) {
if (ac->get_value()) { if (ac->get_value()) {
@ -357,7 +356,6 @@ LaunchControlXL::update_track_control_led(uint8_t n)
b->set_color(Off); b->set_color(Off);
} }
break; break;
case TrackRecord: case TrackRecord:
if (ac) { if (ac) {
if (ac->get_value()) { if (ac->get_value()) {
@ -373,9 +371,11 @@ LaunchControlXL::update_track_control_led(uint8_t n)
default: default:
break; break;
} }
if (ac) { } else {
write (b->state_msg()); b->set_color(Off);
} }
write (b->state_msg());
} }
void void

View file

@ -863,11 +863,9 @@ LaunchControlXL::switch_bank (uint32_t base)
if (stripable[n]->rec_enable_control()) { 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); 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());
} }
} }