mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-02-17 01:31:47 +00:00
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
This commit is contained in:
parent
ee4eced60b
commit
4567f26539
1 changed files with 23 additions and 10 deletions
|
@ -1734,16 +1734,7 @@ void idSoundWorldLocal::AddChannelContribution( idSoundEmitterLocal *sound, idSo
|
|||
volume = soundSystemLocal.dB2Scale( parms->volume );
|
||||
}
|
||||
|
||||
// global volume scale
|
||||
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)
|
||||
// DG: moved global volume scale down to after clamping to 1.0
|
||||
|
||||
// volume fading
|
||||
float fadeDb = chan->channelFade.FadeDbAt44kHz( current44kHz );
|
||||
|
@ -1802,6 +1793,28 @@ void idSoundWorldLocal::AddChannelContribution( idSoundEmitterLocal *sound, idSo
|
|||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
// First clamp it to 1.0 - that's done anyway when setting AL_GAIN below,
|
||||
// for consistency it must be done before scaling, because many player-weapon
|
||||
// sounds have a too high volume defined and only sound right (relative to
|
||||
// other weapons) when clamped
|
||||
// see https://github.com/dhewm/dhewm3/issues/326#issuecomment-1366833004
|
||||
if(volume > 1.0f) {
|
||||
volume = 1.0f;
|
||||
}
|
||||
|
||||
volume *= 0.333f; // (0.333 worked fine, 0.5 didn't)
|
||||
|
||||
// global volume scale - DG: now done after clamping to 1.0, so reducing the
|
||||
// global volume doesn't cause the different weapon volume issues described above
|
||||
volume *= soundSystemLocal.dB2Scale( idSoundSystemLocal::s_volume.GetFloat() );
|
||||
|
||||
//
|
||||
// do we have anything to add?
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue