From 5b83e51ab511cff1cca23decf217928879e1949a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 2 Feb 2020 20:28:01 +0100 Subject: [PATCH] - reverb testing code - toned down the default reverb. --- source/common/sound/s_environment.cpp | 13 ++++++++++++- source/common/sound/s_sound.cpp | 24 +++++++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/source/common/sound/s_environment.cpp b/source/common/sound/s_environment.cpp index 69c582c9c..ff0b6260d 100644 --- a/source/common/sound/s_environment.cpp +++ b/source/common/sound/s_environment.cpp @@ -182,9 +182,20 @@ static ReverbContainer Underwater = false }; -static ReverbContainer SewerPipe = +static ReverbContainer SewerPipe4 = { &Underwater, + "Sewer Pipe 2", + 0x1503, + true, + false, + {0,21, 1.7f, 0.80f, -1000, -1000, 0, 1.81f, 0.14f, 1.0f, 229, 0.014f, 0.0f,0.0f,0.0f, 1023, 0.021f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 80.0f, 60.0f, 0x3f }, + false +}; + +static ReverbContainer SewerPipe = +{ + &SewerPipe4, "Sewer Pipe", 0x1500, true, diff --git a/source/common/sound/s_sound.cpp b/source/common/sound/s_sound.cpp index 415232950..059510eb0 100644 --- a/source/common/sound/s_sound.cpp +++ b/source/common/sound/s_sound.cpp @@ -1735,16 +1735,34 @@ void SoundEngine::AddRandomSound(int Owner, TArray list) } extern ReverbContainer* ForcedEnvironment; +static int LastReverb; + +CUSTOM_CVAR(Bool, snd_reverb, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +{ + FX_SetReverb(-1); +} + +// This is for testing reverb settings. +CUSTOM_CVAR(Int, snd_reverbtype, -1, 0) +{ + FX_SetReverb(-1); +} -CVAR(Bool, snd_reverb, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) void FX_SetReverb(int strength) { - if (snd_reverb && strength > 0) + if (strength == -1) strength = LastReverb; + if (snd_reverbtype > -1) + { + strength = snd_reverbtype; + ForcedEnvironment = S_FindEnvironment(strength); + } + else if (snd_reverb && strength > 0) { // todo: optimize environments. The original "reverb" was garbage and not usable as reference. if (strength < 64) strength = 0x1400; - else if (strength < 192) strength = 0x1500; + else if (strength < 192) strength = 0x1503; else strength = 0x1900; + LastReverb = strength; ForcedEnvironment = S_FindEnvironment(strength); } else ForcedEnvironment = nullptr;