dhewm3/neo
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
..
cm Work around assertion in alphalabs4, fix #409 2022-05-16 05:43:47 +02:00
d3xp StartSoundShader() event: special-case for soundName "", refs #494 2022-10-31 03:20:57 +01:00
framework Bump version to 1.5.3pre 2022-10-22 20:57:48 +02:00
game Fix typo in game/Weapon.cpp from "Fix renderlights ..." commit 2022-12-31 02:00:30 +01:00
idlib Add D3_(v)snprintfC99() for C99-compatible implementations 2022-01-10 04:06:54 +01:00
MayaImport s/LittleLong/LittleInt/ to match the return type 2012-06-28 13:02:47 +02:00
renderer Fix some ubsan warnings 2022-11-06 03:09:05 +01:00
sound Fix scaling down volume of all sounds, #179 #326 2022-12-31 02:00:30 +01:00
sys Remove deprecated warnings on mac for cString use. 2022-07-07 22:47:12 +02:00
tools Fix crash in Radiant Model Preview Dialog, fix #496 2022-10-22 20:47:33 +02:00
TypeInfo Get rid of Sys_FPU_StackIsEmpty() 2012-07-06 01:06:53 +02:00
ui Add absolute mouse mode and refactor mouse grabbing code 2022-01-10 00:46:32 +01:00
CMakeLists.txt HARDLINK_GAME option in cmake 2022-11-06 03:09:05 +01:00
config.h.in Introduce CMAKE_INSTALL_PREFIX relative paths 2012-07-04 02:18:42 +02:00
mmakefile.src # move the AROS specific folder icon and default.cfg mmakefile.src under neo/sys/aros/setup 2017-04-22 16:21:14 +02:00