summaryrefslogtreecommitdiff
path: root/src/audio/audio_fsm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/audio_fsm.cpp')
-rw-r--r--src/audio/audio_fsm.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/audio/audio_fsm.cpp b/src/audio/audio_fsm.cpp
index 424b0eff..a8f1260f 100644
--- a/src/audio/audio_fsm.cpp
+++ b/src/audio/audio_fsm.cpp
@@ -276,7 +276,24 @@ void AudioState::react(const system_fsm::HasPhonesChanged& ev) {
}
void AudioState::react(const SetVolume& ev) {
- // TODO.
+ if (ev.db.has_value()) {
+ if (sOutput->SetVolumeDb(ev.db.value())) {
+ commitVolume();
+ events::Ui().Dispatch(VolumeChanged{
+ .percent = sOutput->GetVolumePct(),
+ .db = sOutput->GetVolumeDb(),
+ });
+ }
+
+ } else if (ev.percent.has_value()) {
+ if (sOutput->SetVolumePct(ev.percent.value())) {
+ commitVolume();
+ events::Ui().Dispatch(VolumeChanged{
+ .percent = sOutput->GetVolumePct(),
+ .db = sOutput->GetVolumeDb(),
+ });
+ }
+ }
}
void AudioState::react(const SetVolumeLimit& ev) {