]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_mix.c
add missing fabs
[xonotic/darkplaces.git] / snd_mix.c
index 3495d86d2fca33b6e3dcd59ae226e9946c688af5..fa0069aaafce4f1f755401dc0554ddbc9c335351 100644 (file)
--- a/snd_mix.c
+++ b/snd_mix.c
@@ -64,8 +64,8 @@ static void S_SoftClipPaintBuffer(portable_sampleframe_t *painted_ptr, int nbfra
 
                // let's do a simple limiter instead, seems to sound better
                static float maxvol = 0;
-               maxvol = max(1.0f, maxvol * (1.0f - nbframes / snd_renderbuffer->format.speed));
-#define SOFTCLIP(x) if((x)>maxvol) maxvol=(x); (x) /= maxvol;
+               maxvol = max(1.0f, maxvol * (1.0f - nbframes / (0.4f * snd_renderbuffer->format.speed)));
+#define SOFTCLIP(x) if(fabs(x)>maxvol) maxvol=fabs(x); (x) /= maxvol;
 
                portable_sampleframe_t *p = painted_ptr;
                if (channels == 8)  // 7.1 surround