mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-26 00:12:05 +08:00
soundd: Set volume on receiving carState (#22795)
This commit is contained in:
@@ -63,6 +63,9 @@ private slots:
|
||||
// scale volume with speed
|
||||
volume = util::map_val((*sm)["carState"].getCarState().getVEgo(), 0.f, 20.f,
|
||||
Hardware::MIN_VOLUME, Hardware::MAX_VOLUME);
|
||||
for (auto &[s, loops] : sounds) {
|
||||
s->setVolume(std::round(100 * volume) / 100);
|
||||
}
|
||||
}
|
||||
if (sm->updated("controlsState")) {
|
||||
const cereal::ControlsState::Reader &cs = (*sm)["controlsState"].getControlsState();
|
||||
@@ -91,7 +94,6 @@ private slots:
|
||||
if (alert.sound != AudibleAlert::NONE) {
|
||||
auto &[s, loops] = sounds[alert.sound];
|
||||
s->setLoopCount(loops);
|
||||
s->setVolume(volume);
|
||||
s->play();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user