FrontendCommon: Fix volume hotkeys starting at 0% when muted

This commit is contained in:
Connor McLaughlin 2020-12-12 11:50:20 +10:00
parent f4d540bcc6
commit 907e0de35a

View file

@ -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<s32>(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<s32>(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);
}