diff options
author | Max Kellermann <max@duempel.org> | 2013-12-22 21:08:06 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-12-22 21:08:06 +0100 |
commit | 86e72ffefb886f6151add595fa33028859249d59 (patch) | |
tree | b1678609df9c9875be5510205db8c90461eeff38 /src/pcm | |
parent | 6416198e9f57e4ea59a9bdc4deb2856c562681e6 (diff) | |
download | mpd-86e72ffefb886f6151add595fa33028859249d59.tar.gz mpd-86e72ffefb886f6151add595fa33028859249d59.tar.xz mpd-86e72ffefb886f6151add595fa33028859249d59.zip |
util/Clamp: generic Clamp() function
Diffstat (limited to 'src/pcm')
-rw-r--r-- | src/pcm/PcmMix.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pcm/PcmMix.cxx b/src/pcm/PcmMix.cxx index fab2d8154..2866aa456 100644 --- a/src/pcm/PcmMix.cxx +++ b/src/pcm/PcmMix.cxx @@ -23,6 +23,7 @@ #include "PcmUtils.hxx" #include "AudioFormat.hxx" #include "Traits.hxx" +#include "util/Clamp.hxx" #include <assert.h> #include <math.h> @@ -215,7 +216,7 @@ pcm_mix(void *buffer1, const void *buffer2, size_t size, s *= s; vol1 = s * PCM_VOLUME_1 + 0.5; - vol1 = vol1 > PCM_VOLUME_1 ? PCM_VOLUME_1 : (vol1 < 0 ? 0 : vol1); + vol1 = Clamp<int>(vol1, 0, PCM_VOLUME_1); return pcm_add_vol(buffer1, buffer2, size, vol1, PCM_VOLUME_1 - vol1, format); } |