shithub: dumb

Download patch

ref: b85fdab6f8102a7df5925d58a4e07b98ed69dd4a
parent: da31373331b91be6d6dd7e83a1e6eee94b0a585a
author: Chris Moeller <[email protected]>
date: Thu Nov 7 12:52:50 EST 2013

Simplified pan law calculation a bit

--- a/dumb/src/it/itrender.c
+++ b/dumb/src/it/itrender.c
@@ -3993,13 +3993,15 @@
 	pan = apply_pan_envelope(playing);
 
 	if ((sigrenderer->n_channels >= 2) && (sigdata->flags & IT_STEREO) && (sigrenderer->n_channels != 3 || !IT_IS_SURROUND_SHIFTED(pan))) {
-		span = (pan - (32<<8)) * sigdata->pan_separation * (1.0f / ((32<<8) * 128));
-		vol = 0.5f;
-		if (!IT_IS_SURROUND_SHIFTED(pan)) vol *= 1.0f - span;
- 		playing->float_volume[0] = vol;
-		vol = -vol;
-		if (!IT_IS_SURROUND_SHIFTED(pan)) vol += 1.0f;
- 		playing->float_volume[1] = vol;
+		if (!IT_IS_SURROUND_SHIFTED(pan)) {
+			span = (pan - (32<<8)) * sigdata->pan_separation * (1.0f / ((32<<8) * 128));
+			vol = 0.5f * (1.0f - span);
+			playing->float_volume[0] = vol;
+			playing->float_volume[1] = 1.0f - vol;
+		} else {
+			playing->float_volume[0] = -0.5f;
+			playing->float_volume[1] = 0.5f;
+		}
  	} else {
 		playing->float_volume[0] = 1.0f;
 		playing->float_volume[1] = 1.0f;