diff --git a/selfdrive/hardware/base.h b/selfdrive/hardware/base.h index d9ce5c48c3..3c11ef8f08 100644 --- a/selfdrive/hardware/base.h +++ b/selfdrive/hardware/base.h @@ -6,8 +6,8 @@ // no-op base hw class class HardwareNone { public: - static constexpr float MAX_VOLUME = 0; - static constexpr float MIN_VOLUME = 0; + static constexpr float MAX_VOLUME = 1.0; + static constexpr float MIN_VOLUME = 0.5; static std::string get_os_version() { return ""; } diff --git a/selfdrive/ui/soundd.cc b/selfdrive/ui/soundd.cc index f6d3cfc597..83063c1a54 100644 --- a/selfdrive/ui/soundd.cc +++ b/selfdrive/ui/soundd.cc @@ -30,6 +30,7 @@ static std::tuple sound_list[] = { {AudibleAlert::CHIME_ERROR, "error.wav", false}, {AudibleAlert::CHIME_PROMPT, "error.wav", false}, }; + class Sound : public QObject { public: explicit Sound(QObject *parent = 0) : sm({"carState", "controlsState"}) { @@ -41,6 +42,7 @@ public: assert(s->status() != QSoundEffect::Error); }); s->setSource(QUrl::fromLocalFile(sound_asset_path + fn)); + s->setVolume(current_volume); sounds[alert] = {s, loops ? QSoundEffect::Infinite : 0}; } @@ -93,7 +95,7 @@ public: AudibleAlert current_sound = AudibleAlert::NONE; QString current_alert_type; - float current_volume = 0.; + float current_volume = Hardware::MIN_VOLUME; QMap> sounds; SubMaster sm;