diff --git a/neo/sound/snd_local.h b/neo/sound/snd_local.h index d365e44c..6c5790eb 100644 --- a/neo/sound/snd_local.h +++ b/neo/sound/snd_local.h @@ -601,6 +601,7 @@ public: ALuint listenerSlot; bool listenerAreFiltersInitialized; ALuint listenerFilters[2]; // 0 - direct; 1 - send. + float listenerSlotReverbGain; int gameMsec; int game44kHz; @@ -751,6 +752,7 @@ public: LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots; LPALISAUXILIARYEFFECTSLOT alIsAuxiliaryEffectSlot; LPALAUXILIARYEFFECTSLOTI alAuxiliaryEffectSloti; + LPALAUXILIARYEFFECTSLOTF alAuxiliaryEffectSlotf; idEFXFile EFXDatabase; bool efxloaded; @@ -793,6 +795,8 @@ public: static idCVar s_useEAXReverb; static idCVar s_decompressionLimit; + static idCVar s_alReverbGain; + static idCVar s_slowAttenuate; static idCVar s_enviroSuitCutoffFreq; diff --git a/neo/sound/snd_system.cpp b/neo/sound/snd_system.cpp index d9a2848c..ce37c975 100644 --- a/neo/sound/snd_system.cpp +++ b/neo/sound/snd_system.cpp @@ -77,6 +77,8 @@ idCVar idSoundSystemLocal::s_useEAXReverb( "s_useEAXReverb", "0", CVAR_SOUND | C idCVar idSoundSystemLocal::s_decompressionLimit( "s_decompressionLimit", "6", CVAR_SOUND | CVAR_INTEGER | CVAR_ROM, "specifies maximum uncompressed sample length in seconds" ); #endif +idCVar idSoundSystemLocal::s_alReverbGain( "s_alReverbGain", "0.5", CVAR_SOUND | CVAR_FLOAT | CVAR_ARCHIVE, "reduce reverb strength (0.0 to 1.0)", 0.0f, 1.0f ); + bool idSoundSystemLocal::useEFXReverb = false; int idSoundSystemLocal::EFXAvailable = -1; @@ -429,6 +431,7 @@ void idSoundSystemLocal::Init() { alDeleteAuxiliaryEffectSlots = (LPALDELETEAUXILIARYEFFECTSLOTS)alGetProcAddress("alDeleteAuxiliaryEffectSlots"); alIsAuxiliaryEffectSlot = (LPALISAUXILIARYEFFECTSLOT)alGetProcAddress("alIsAuxiliaryEffectSlot");; alAuxiliaryEffectSloti = (LPALAUXILIARYEFFECTSLOTI)alGetProcAddress("alAuxiliaryEffectSloti"); + alAuxiliaryEffectSlotf = (LPALAUXILIARYEFFECTSLOTF)alGetProcAddress("alAuxiliaryEffectSlotf"); } else { common->Printf( "OpenAL: EFX extension not found\n" ); EFXAvailable = 0; @@ -449,6 +452,7 @@ void idSoundSystemLocal::Init() { alDeleteAuxiliaryEffectSlots = NULL; alIsAuxiliaryEffectSlot = NULL; alAuxiliaryEffectSloti = NULL; + alAuxiliaryEffectSlotf = NULL; } ALuint handle; diff --git a/neo/sound/snd_world.cpp b/neo/sound/snd_world.cpp index bbf25f99..d7982d42 100644 --- a/neo/sound/snd_world.cpp +++ b/neo/sound/snd_world.cpp @@ -93,6 +93,9 @@ void idSoundWorldLocal::Init( idRenderWorld *renderWorld ) { // pow(10.0, (-1150*1.5)/2000.0) soundSystemLocal.alFilterf(listenerFilters[1], AL_LOWPASS_GAINHF, 0.137246f); } + // allow reducing the gain effect globally via s_alReverbGain CVar + listenerSlotReverbGain = soundSystemLocal.s_alReverbGain.GetFloat(); + soundSystemLocal.alAuxiliaryEffectSlotf(listenerSlot, AL_EFFECTSLOT_GAIN, listenerSlotReverbGain); } } @@ -130,6 +133,7 @@ idSoundWorldLocal::idSoundWorldLocal() { listenerEffect = 0; listenerSlot = 0; listenerAreFiltersInitialized = false; + listenerSlotReverbGain = 1.0f; } /* @@ -182,6 +186,7 @@ void idSoundWorldLocal::Shutdown() { listenerFilters[1] = AL_FILTER_NULL; } } + listenerSlotReverbGain = 1.0f; } localSound = NULL; @@ -524,6 +529,13 @@ void idSoundWorldLocal::MixLoop( int current44kHz, int numSpeakers, float *final ALuint effect = 0; idStr s(listenerArea); + // allow reducing the gain effect globally via s_alReverbGain CVar + float gain = soundSystemLocal.s_alReverbGain.GetFloat(); + if (listenerSlotReverbGain != gain) { + listenerSlotReverbGain = gain; + soundSystemLocal.alAuxiliaryEffectSlotf(listenerSlot, AL_EFFECTSLOT_GAIN, gain); + } + bool found = soundSystemLocal.EFXDatabase.FindEffect(s, &effect); if (!found) { s = listenerAreaName;