13
0

Console1: catch some more uncaught exceptions

This commit is contained in:
Robin Gareus 2023-10-19 23:46:43 +02:00
parent 8f5df7ed28
commit 99e2546477
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -581,21 +581,25 @@ void
Console1::map_mute () Console1::map_mute ()
{ {
DEBUG_TRACE (DEBUG::Console1, "Console1::map_mute ...\n"); DEBUG_TRACE (DEBUG::Console1, "Console1::map_mute ...\n");
if (_current_stripable) { try {
if (_current_stripable->mute_control ()->muted ()) { if (_current_stripable) {
get_button (swap_solo_mute ? SOLO : MUTE)->set_led_state (true); if (_current_stripable->mute_control ()->muted ()) {
} else if (_current_stripable->mute_control ()->muted_by_others_soloing () || get_button (swap_solo_mute ? SOLO : MUTE)->set_led_state (true);
_current_stripable->mute_control ()->muted_by_masters ()) { } else if (_current_stripable->mute_control ()->muted_by_others_soloing () ||
_current_stripable->mute_control ()->muted_by_masters ()) {
DEBUG_TRACE (DEBUG::Console1, "Console1::map_mute start blinking\n"); DEBUG_TRACE (DEBUG::Console1, "Console1::map_mute start blinking\n");
start_blinking (swap_solo_mute ? SOLO : MUTE); start_blinking (swap_solo_mute ? SOLO : MUTE);
} else {
DEBUG_TRACE (DEBUG::Console1, "Console1::map_mute stop blinking\n");
stop_blinking (swap_solo_mute ? SOLO : MUTE);
}
} else { } else {
DEBUG_TRACE (DEBUG::Console1, "Console1::map_mute stop blinking\n"); DEBUG_TRACE (DEBUG::Console1, "Console1::map_mute stop blinking 2\n");
stop_blinking (swap_solo_mute ? SOLO : MUTE); stop_blinking (swap_solo_mute ? SOLO : MUTE);
} }
} else { } catch (ControlNotFoundException const&) {
DEBUG_TRACE (DEBUG::Console1, "Console1::map_mute stop blinking 2\n"); DEBUG_TRACE (DEBUG::Console1, "Button not found\n");
stop_blinking (swap_solo_mute ? SOLO : MUTE);
} }
} }
@ -613,24 +617,28 @@ void
Console1::map_phase () Console1::map_phase ()
{ {
DEBUG_TRACE (DEBUG::Console1, "map_phase \n"); DEBUG_TRACE (DEBUG::Console1, "map_phase \n");
ControllerButton* controllerButton = get_button (PHASE_INV); try {
if (_current_stripable && _current_stripable->phase_control ()) { ControllerButton* controllerButton = get_button (PHASE_INV);
uint32_t channels = _current_stripable->phase_control ()->size (); if (_current_stripable && _current_stripable->phase_control ()) {
uint32_t inverted = 0; uint32_t channels = _current_stripable->phase_control ()->size ();
for (uint32_t i = 0; i < channels; ++i) { uint32_t inverted = 0;
if (_current_stripable->phase_control ()->inverted (i)) for (uint32_t i = 0; i < channels; ++i) {
++inverted; if (_current_stripable->phase_control ()->inverted (i))
} ++inverted;
if (inverted == 0) { }
stop_blinking (PHASE_INV); if (inverted == 0) {
stop_blinking (PHASE_INV);
controllerButton->set_led_state (false);
} else if (inverted == channels) {
stop_blinking (PHASE_INV);
controllerButton->set_led_state (true);
} else
start_blinking (PHASE_INV);
} else {
controllerButton->set_led_state (false); controllerButton->set_led_state (false);
} else if (inverted == channels) { }
stop_blinking (PHASE_INV); } catch (ControlNotFoundException const&) {
controllerButton->set_led_state (true); DEBUG_TRACE (DEBUG::Console1, "Button not found\n");
} else
start_blinking (PHASE_INV);
} else {
controllerButton->set_led_state (false);
} }
} }
@ -650,7 +658,11 @@ Console1::map_select ()
{ {
DEBUG_TRACE (DEBUG::Console1, "map_select())\n"); DEBUG_TRACE (DEBUG::Console1, "map_select())\n");
for (uint32_t i = 0; i < bank_size; ++i) { for (uint32_t i = 0; i < bank_size; ++i) {
get_button (ControllerID (FOCUS1 + i))->set_led_state (i == current_strippable_index); try {
get_button (ControllerID (FOCUS1 + i))->set_led_state (i == current_strippable_index);
} catch (ControlNotFoundException const&) {
DEBUG_TRACE (DEBUG::Console1, "Button not found\n");
}
} }
} }