From fdbd08e306508837cf22dc93c72c3222d3cb8a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Heres?= Date: Fri, 23 Oct 2015 14:06:38 +0200 Subject: [PATCH] Calculate correct d_left / d_right --- src/audio/mixer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/audio/mixer.cpp b/src/audio/mixer.cpp index 0706f641c8..e232fa908e 100644 --- a/src/audio/mixer.cpp +++ b/src/audio/mixer.cpp @@ -738,11 +738,11 @@ void Mixer::MixChannel(Channel& channel, uint8* data, int length) void Mixer::EffectPanS16(Channel& channel, sint16* data, int length) { - const float dt = 1 / (length * 2); + const float dt = 1.0f / (length * 2); float left_volume = channel.oldvolume_l; float right_volume = channel.oldvolume_r; - const float d_left = dt * channel.volume_l; - const float d_right = dt * channel.volume_r; + const float d_left = dt * (channel.volume_l - channel.oldvolume_l); + const float d_right = dt * (channel.volume_r - channel.oldvolume_r); for (int i = 0; i < length * 2; i += 2) { data[i] = (sint16)(data[i] * left_volume);