From 3914eb5f85226de11ea41addb6645323d586daeb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 22 Dec 2019 17:43:39 +0100 Subject: [PATCH] - set up some basic reverb. I'm not sure if this is working out as the original "reverb" was just too crappy and generic. It may be best to just disable it. --- source/common/sound/backend/oalsound.cpp | 1 - source/common/sound/s_sound.cpp | 17 +++++++++++++++++ source/common/sound/s_soundinternal.h | 5 +---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/source/common/sound/backend/oalsound.cpp b/source/common/sound/backend/oalsound.cpp index 2f8157efa..327129335 100644 --- a/source/common/sound/backend/oalsound.cpp +++ b/source/common/sound/backend/oalsound.cpp @@ -2366,5 +2366,4 @@ void I_BuildALResamplersList(FOptionValues* opt) #endif } - #endif // NO_OPENAL diff --git a/source/common/sound/s_sound.cpp b/source/common/sound/s_sound.cpp index 60aeeb2cb..af9bcb1de 100644 --- a/source/common/sound/s_sound.cpp +++ b/source/common/sound/s_sound.cpp @@ -39,6 +39,7 @@ #include "s_soundinternal.h" #include "m_swap.h" #include "superfasthash.h" +#include "c_cvars.h" #ifdef _WIN32 #undef DrawText @@ -1725,6 +1726,22 @@ void SoundEngine::AddRandomSound(int Owner, TArray list) S_sfx[Owner].NearLimit = -1; } +extern ReverbContainer* ForcedEnvironment; + +CVAR(Bool, snd_reverb, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +void FX_SetReverb(int strength) +{ + if (snd_reverb) + { + // 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 strength = 0x1900; + ForcedEnvironment = S_FindEnvironment(strength); + } +} + + #include "basics.h" #include "stats.h" #include "v_text.h" diff --git a/source/common/sound/s_soundinternal.h b/source/common/sound/s_soundinternal.h index ae56ca038..2241ffede 100644 --- a/source/common/sound/s_soundinternal.h +++ b/source/common/sound/s_soundinternal.h @@ -430,10 +430,7 @@ inline void FX_StopAllSounds(void) soundEngine->StopAllChannels(); } -inline void FX_SetReverb(int strength) -{ - // todo: investigate how this works and set a proper environment. -} +void FX_SetReverb(int strength); inline void FX_SetReverbDelay(int delay) {