Fix some alert sounds not repeating (#1763)

* fix sounds not repeating

* fix PC build

* 3 loop

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: af22b282ff20201914a462488700971cfe32cb20
This commit is contained in:
Adeeb Shihadeh
2020-06-22 19:22:02 -07:00
committed by GitHub
parent 00bc04a870
commit 4c19a49586
5 changed files with 29 additions and 29 deletions
+3 -3
View File
@@ -308,7 +308,7 @@ void handle_message(UIState *s, SubMaster &sm) {
if (!scene.frontview){ s->controls_seen = true; }
auto alert_sound = scene.controls_state.getAlertSound();
if (alert_sound != s->sound.currentPlaying()) {
if (scene.alert_text2.compare(scene.controls_state.getAlertText2()) != 0) {
if (alert_sound == AudibleAlert::NONE) {
s->sound.stop();
} else {
@@ -852,7 +852,7 @@ int main(int argc, char* argv[]) {
should_swap = true;
}
s->sound.setVolume(fmin(MAX_VOLUME, MIN_VOLUME + s->scene.controls_state.getVEgo() / 5), 5); // up one notch every 5 m/s
s->sound.setVolume(fmin(MAX_VOLUME, MIN_VOLUME + s->scene.controls_state.getVEgo() / 5)); // up one notch every 5 m/s
if (s->controls_timeout > 0) {
s->controls_timeout--;
@@ -869,7 +869,7 @@ int main(int argc, char* argv[]) {
LOGE("Controls unresponsive");
if (s->scene.alert_text2 != "Controls Unresponsive") {
s->sound.play(AudibleAlert::CHIME_WARNING_REPEAT, 3); // loop sound 3 times
s->sound.play(AudibleAlert::CHIME_WARNING_REPEAT);
}
s->scene.alert_text1 = "TAKE CONTROL IMMEDIATELY";