From 432b86fdeb710416f59be6843fac5813ba98e2bc Mon Sep 17 00:00:00 2001 From: "Boris I. Bendovsky" Date: Wed, 25 Nov 2020 20:38:21 +0200 Subject: [PATCH] Calculate EFX density as in EFX-Util --- neo/sound/snd_efxfile.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/neo/sound/snd_efxfile.cpp b/neo/sound/snd_efxfile.cpp index 594afe8b..014f1013 100644 --- a/neo/sound/snd_efxfile.cpp +++ b/neo/sound/snd_efxfile.cpp @@ -199,8 +199,13 @@ bool idEFXFile::ReadEffect( idLexer &src, idSoundEffect *effect ) { // <+KittyCat> the "environment" token should be ignored (efx has nothing equatable to it) src.ParseInt(); } else if ( token == "environment size" ) { + // + // The formula for density according to Creative's EFX-Util.lib: + // density = clamp(pow(size, 3) / 16, 0, 1) + // float size = src.ParseFloat(); - efxf(AL_EAXREVERB_DENSITY, (size < 2.0f) ? (size - 1.0f) : 1.0f); + size = idMath::ClampFloat(0.0f, 1.0f, (size * size * size) / 16.0f); + efxf(AL_EAXREVERB_DENSITY, size); } else if ( token == "environment diffusion" ) { efxf(AL_EAXREVERB_DIFFUSION, src.ParseFloat()); } else if ( token == "room" ) {