dhewm3/neo/sound
Daniel Gibson 4567f26539 Fix scaling down volume of all sounds, #179 #326
Commit 3c01757d27 introduced scaling down all sounds to prevent too
many loud-ish sounds from making OpenAL scale the overall volume down.

The problem is that before this change, many sounds had a volume > 1.0,
but vastly different: e.g. player_machinegun_fire was 5.039685 (14dB)
and player_chaingun_fire was 1.414214 (3dB).
But in the end, all volumes were clamped to 1.0 before setting AL_GAIN
(because AL_GAIN only supports values between 0 and 1 by default), so
the machinegun and chaingun had the same volume after all.

When scaling those down to 1/3 of the original volume, some sounds that
used to have a volume of >= 1.0 (=> AL_GAIN set to 1.0) had a volume
lower than 1.0, so they suddenly the chaingun sounded quiter than
the machinegun. While theoretically this is more correct than before
(after all, the sound shader of player_chaingun_fire set a much lower
 volume than that of player_machinegun_fire), it doesn't sound like it
used to (even with the old software sound backend!).

Clamping to 1.0 *before* scaling to 1/3 should restore the old behavior
(of all sounds with volume > 1.0 before clamping using the same AL_GAIN)
while still avoiding the issue of having OpenAL (Soft) scale down the
overall volume when shooting a metal wall with the shotgun.

Unsurprisingly the same problem (inconsistent weapon volumes due to
incorrect sound shaders setting the volume way to high and thus relying
on being clamped to 1.0) that occurred with my volume *= 0.333 hack
also happens when reducing the global volume.
So apply that global volume scale *after* clamping to 1.0

see https://github.com/bibendovsky/eaxefx/pull/28#issuecomment-1367436162
2022-12-31 02:00:30 +01:00
..
efxlib.h Cleanup EFX code 2012-01-10 17:45:37 +01:00
snd_cache.cpp idSoundSample::Load() uses s_decompressionLimit for oggs again 2021-04-27 20:08:59 +02:00
snd_decoder.cpp Disable assertion in idSampleDecoderLocal::Decode*(), fix #461 2022-05-28 18:05:49 +02:00
snd_efxfile.cpp Calculate EFX density as in EFX-Util 2021-01-15 17:57:17 +01:00
snd_emitter.cpp Properly pause sounds when entering menu, fixes #330 2021-04-27 20:08:59 +02:00
snd_local.h Add s_alReverbGain CVar to reduce intensity of reverb effects, fix #365 2021-04-27 20:08:59 +02:00
snd_shader.cpp Untangle the epic precompiled.h mess 2011-12-19 23:21:47 +01:00
snd_system.cpp Restore C++98 compatibility (NULL instead of nullptr) 2021-07-17 18:24:46 +02:00
snd_wavefile.cpp Use stb_vorbis instead of libogg and libvorbis(file) 2021-04-27 20:08:59 +02:00
snd_world.cpp Fix scaling down volume of all sounds, #179 #326 2022-12-31 02:00:30 +01:00
sound.h Port EAX to EFX 2012-01-08 22:04:56 +01:00
stb_vorbis.h Update stb_vorbis to v1.22 and stb_image to v2.27 2021-10-31 06:14:59 +01:00