From 907e0de35ae2cfe2eabf5e535fb0c6094bb1ec42 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 12 Dec 2020 11:50:20 +1000 Subject: [PATCH] FrontendCommon: Fix volume hotkeys starting at 0% when muted --- src/frontend-common/common_host_interface.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/frontend-common/common_host_interface.cpp b/src/frontend-common/common_host_interface.cpp index d4794e242..49703aacd 100644 --- a/src/frontend-common/common_host_interface.cpp +++ b/src/frontend-common/common_host_interface.cpp @@ -1704,10 +1704,11 @@ void CommonHostInterface::RegisterAudioHotkeys() StaticString(TRANSLATABLE("Hotkeys", "Volume Up")), [this](bool pressed) { if (pressed && System::IsValid()) { + g_settings.audio_output_muted = false; + const s32 volume = std::min(GetAudioOutputVolume() + 10, 100); g_settings.audio_output_volume = volume; g_settings.audio_fast_forward_volume = volume; - g_settings.audio_output_muted = false; m_audio_stream->SetOutputVolume(volume); AddFormattedOSDMessage(2.0f, TranslateString("OSDMessage", "Volume: %d%%"), volume); } @@ -1716,10 +1717,11 @@ void CommonHostInterface::RegisterAudioHotkeys() StaticString(TRANSLATABLE("Hotkeys", "Volume Down")), [this](bool pressed) { if (pressed && System::IsValid()) { + g_settings.audio_output_muted = false; + const s32 volume = std::max(GetAudioOutputVolume() - 10, 0); g_settings.audio_output_volume = volume; g_settings.audio_fast_forward_volume = volume; - g_settings.audio_output_muted = false; m_audio_stream->SetOutputVolume(volume); AddFormattedOSDMessage(2.0f, TranslateString("OSDMessage", "Volume: %d%%"), volume); }