diff options
Diffstat (limited to 'src/audio/audio_fsm.cpp')
| -rw-r--r-- | src/audio/audio_fsm.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/audio/audio_fsm.cpp b/src/audio/audio_fsm.cpp index 90bfd60b..a5179156 100644 --- a/src/audio/audio_fsm.cpp +++ b/src/audio/audio_fsm.cpp @@ -129,7 +129,7 @@ void Uninitialised::react(const system_fsm::BootComplete& ev) { auto& nvs = sServices->nvs(); sI2SOutput->SetMaxVolume(nvs.AmpMaxVolume()); - sI2SOutput->SetVolumeDb(nvs.AmpCurrentVolume()); + sI2SOutput->SetVolume(nvs.AmpCurrentVolume()); if (sServices->nvs().OutputMode() == drivers::NvsStorage::Output::kHeadphones) { @@ -188,6 +188,10 @@ void Playback::exit() { vTaskDelay(pdMS_TO_TICKS(10)); sOutput->SetMode(IAudioOutput::Modes::kOnPaused); + // Stash the current volume now, in case it changed during playback, since we + // might be powering off soon. + sServices->nvs().AmpCurrentVolume(sOutput->GetVolume()); + events::System().Dispatch(PlaybackFinished{}); events::Ui().Dispatch(PlaybackFinished{}); } |
