From e8f328d8adc91568e5c0c683e640b4e70bdeb563 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 6 Aug 2021 17:56:29 +0200 Subject: [PATCH] mixer/alsa: move code to GetPercentVolume() --- src/mixer/plugins/AlsaMixerPlugin.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mixer/plugins/AlsaMixerPlugin.cxx b/src/mixer/plugins/AlsaMixerPlugin.cxx index fd4c6817d..844b56105 100644 --- a/src/mixer/plugins/AlsaMixerPlugin.cxx +++ b/src/mixer/plugins/AlsaMixerPlugin.cxx @@ -107,6 +107,11 @@ private: return get_normalized_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT); } + + [[gnu::pure]] + unsigned GetPercentVolume() const noexcept { + return NormalizedToPercent(GetNormalizedVolume()); + } }; static constexpr Domain alsa_mixer_domain("alsa_mixer"); @@ -285,7 +290,7 @@ AlsaMixer::GetVolume() throw FormatRuntimeError("snd_mixer_handle_events() failed: %s", snd_strerror(err)); - return NormalizedToPercent(GetNormalizedVolume()); + return GetPercentVolume(); } void