From 49116b4ae7dd31fd736a33913a2969c0653a06cb Mon Sep 17 00:00:00 2001 From: Adrian Frühwirth Date: Thu, 3 May 2018 21:54:58 +0200 Subject: ALL: Use CLIP to clip volumes --- audio/mixer.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'audio/mixer.cpp') diff --git a/audio/mixer.cpp b/audio/mixer.cpp index 16cf5640eb..274f8e9de6 100644 --- a/audio/mixer.cpp +++ b/audio/mixer.cpp @@ -471,10 +471,7 @@ void MixerImpl::setVolumeForSoundType(SoundType type, int volume) { assert(0 <= (int)type && (int)type < ARRAYSIZE(_soundTypeSettings)); // Check range - if (volume > kMaxMixerVolume) - volume = kMaxMixerVolume; - else if (volume < 0) - volume = 0; + volume = CLIP(volume, 0, kMaxMixerVolume); // TODO: Maybe we should do logarithmic (not linear) volume // scaling? See also Player_V2::setMasterVolume -- cgit v1.2.3