diff --git a/selfdrive/assets/offroad/icon_mute.png b/selfdrive/assets/offroad/icon_mute.png new file mode 100644 index 0000000000..3e31a13787 Binary files /dev/null and b/selfdrive/assets/offroad/icon_mute.png differ diff --git a/selfdrive/ui/soundd/sound.cc b/selfdrive/ui/soundd/sound.cc index 49c28373c5..45f51bf413 100644 --- a/selfdrive/ui/soundd/sound.cc +++ b/selfdrive/ui/soundd/sound.cc @@ -68,10 +68,17 @@ void Sound::setAlert(const Alert &alert) { } // play sound - if (alert.sound != AudibleAlert::NONE) { + if (shouldPlaySound(alert)) { auto &[s, loops] = sounds[alert.sound]; s->setLoopCount(loops); s->play(); } } } + +bool Sound::shouldPlaySound(const Alert &alert) { + bool isQuietDrive = params.getBool("QuietDrive"); + return (alert.sound == AudibleAlert::WARNING_SOFT || alert.sound == AudibleAlert::WARNING_IMMEDIATE || + alert.sound == AudibleAlert::PROMPT_DISTRACTED || alert.sound == AudibleAlert::PROMPT_REPEAT) || + (!isQuietDrive && alert.sound != AudibleAlert::NONE); +} diff --git a/selfdrive/ui/soundd/sound.h b/selfdrive/ui/soundd/sound.h index 7e009d28ad..17e32ca477 100644 --- a/selfdrive/ui/soundd/sound.h +++ b/selfdrive/ui/soundd/sound.h @@ -26,9 +26,13 @@ public: protected: void update(); void setAlert(const Alert &alert); + bool shouldPlaySound(const Alert &alert); Alert current_alert = {}; QMap> sounds; SubMaster sm; uint64_t started_frame; + +private: + Params params; };