Scale down volume of all sounds, fixes #179

so even with many loud sounds the overall volume isn't reduced by
OpenAL - apparently OpenAL scales down all sounds temporarily if the
mixed result would be too loud or sth like that.
Just sending all sounds to OpenAL with a lower volume prevents that from
happening (just set your system speaker volume a bit higher if needed).
This problem was especially noticable when shooting at metal walls with
the shotgun (each pellet produces an impact sound so it gets kinda loud)
This commit is contained in:
Daniel Gibson 2018-02-12 03:30:03 +01:00
parent ebac192352
commit 3c01757d27

View file

@ -1675,6 +1675,13 @@ void idSoundWorldLocal::AddChannelContribution( idSoundEmitterLocal *sound, idSo
// global volume scale // global volume scale
volume *= soundSystemLocal.dB2Scale( idSoundSystemLocal::s_volume.GetFloat() ); volume *= soundSystemLocal.dB2Scale( idSoundSystemLocal::s_volume.GetFloat() );
// DG: scaling the volume of *everything* down a bit to prevent some sounds
// (like shotgun shot) being "drowned" when lots of other loud sounds
// (like shotgun impacts on metal) are played at the same time
// I guess this happens because the loud sounds mixed together are too loud so
// OpenAL just makes *everything* quiter or sth like that.
// See also https://github.com/dhewm/dhewm3/issues/179
volume *= 0.333f; // (0.333 worked fine, 0.5 didn't)
// volume fading // volume fading
float fadeDb = chan->channelFade.FadeDbAt44kHz( current44kHz ); float fadeDb = chan->channelFade.FadeDbAt44kHz( current44kHz );