diff options
author | Max Kellermann <max@duempel.org> | 2013-12-22 17:36:21 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-12-22 21:20:40 +0100 |
commit | bfe020e06c2ba0671cdd1dacd9999c986c3168d6 (patch) | |
tree | 41a9f57e6987785ca293a8586371f04d023a32df /src/pcm/PcmMix.cxx | |
parent | 5aae560683318b870df9989cdcc2ac576626b234 (diff) | |
download | mpd-bfe020e06c2ba0671cdd1dacd9999c986c3168d6.tar.gz mpd-bfe020e06c2ba0671cdd1dacd9999c986c3168d6.tar.xz mpd-bfe020e06c2ba0671cdd1dacd9999c986c3168d6.zip |
pcm/Volume: make PCM_VOLUME_1 a "constexpr"
Diffstat (limited to '')
-rw-r--r-- | src/pcm/PcmMix.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/pcm/PcmMix.cxx b/src/pcm/PcmMix.cxx index 2866aa456..ffe935a0f 100644 --- a/src/pcm/PcmMix.cxx +++ b/src/pcm/PcmMix.cxx @@ -36,8 +36,8 @@ PcmAddVolume(typename Traits::value_type _a, typename Traits::value_type _b, typename Traits::long_type a(_a), b(_b); typename Traits::value_type c = ((a * volume1 + b * volume2) + - pcm_volume_dither() + PCM_VOLUME_1 / 2) - / PCM_VOLUME_1; + pcm_volume_dither() + PCM_VOLUME_1S / 2) + / PCM_VOLUME_1S; return PcmClamp<F, Traits>(c); } @@ -204,7 +204,6 @@ bool pcm_mix(void *buffer1, const void *buffer2, size_t size, SampleFormat format, float portion1) { - int vol1; float s; /* portion1 is between 0.0 and 1.0 for crossfading, MixRamp uses -1 @@ -215,8 +214,8 @@ pcm_mix(void *buffer1, const void *buffer2, size_t size, s = sin(M_PI_2 * portion1); s *= s; - vol1 = s * PCM_VOLUME_1 + 0.5; - vol1 = Clamp<int>(vol1, 0, PCM_VOLUME_1); + int vol1 = s * PCM_VOLUME_1S + 0.5; + vol1 = Clamp<int>(vol1, 0, PCM_VOLUME_1S); - return pcm_add_vol(buffer1, buffer2, size, vol1, PCM_VOLUME_1 - vol1, format); + return pcm_add_vol(buffer1, buffer2, size, vol1, PCM_VOLUME_1S - vol1, format); } |