From d066a7a6d12a9e96a6941ced62643c63fedba37d Mon Sep 17 00:00:00 2001
From: Alam Ed Arias <alam@srb2.org>
Date: Mon, 4 Aug 2014 11:57:29 -0400
Subject: [PATCH]  Change mixer panning to make sense (for SDL12)

    This makes positional audio in sdl work correctly (things to the left
    play sounds in the left speaker)
---
 src/sdl12/mixer_sound.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sdl12/mixer_sound.c b/src/sdl12/mixer_sound.c
index 151668752c..542a671698 100644
--- a/src/sdl12/mixer_sound.c
+++ b/src/sdl12/mixer_sound.c
@@ -381,7 +381,7 @@ INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priori
 	UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127
 	INT32 handle = Mix_PlayChannel(-1, S_sfx[id].data, 0);
 	Mix_Volume(handle, volume);
-	Mix_SetPanning(handle, min((UINT16)sep<<1, 0xff), min((UINT16)(0xff-sep)<<1, 0xff));
+	Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff));
 	(void)pitch; // Mixer can't handle pitch
 	(void)priority; // priority and channel management is handled by SRB2...
 	return handle;
@@ -401,7 +401,7 @@ void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch)
 {
 	UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127
 	Mix_Volume(handle, volume);
-	Mix_SetPanning(handle, min((UINT16)sep<<1, 0xff), min((UINT16)(0xff-sep)<<1, 0xff));
+	Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff));
 	(void)pitch;
 }
 
-- 
GitLab