diff options
| author | ailurux <ailuruxx@gmail.com> | 2024-03-01 19:08:54 +1100 |
|---|---|---|
| committer | ailurux <ailuruxx@gmail.com> | 2024-03-01 19:08:54 +1100 |
| commit | 6586819171b635e3b17effb3bfab096da695a0e9 (patch) | |
| tree | 9c803134aa2e138303a155644c99bfb7a9e0193b /src/audio/audio_fsm.cpp | |
| parent | 5141c9f0bd62e575fff9e132c0ad6de089a18ece (diff) | |
| download | tangara-fw-6586819171b635e3b17effb3bfab096da695a0e9.tar.gz | |
WIP Commit- Lua setters for volume, bluetooth todo
Diffstat (limited to 'src/audio/audio_fsm.cpp')
| -rw-r--r-- | src/audio/audio_fsm.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/audio/audio_fsm.cpp b/src/audio/audio_fsm.cpp index ea0315eb..7800802e 100644 --- a/src/audio/audio_fsm.cpp +++ b/src/audio/audio_fsm.cpp @@ -98,7 +98,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) { |
