Make limiting power screen sounds to 16 optional.

This was added in e3e5bd1 as a work around for some openal-soft bug.
When too many audio samples got played at the same time, the global
volume dropped. This was fixed in openal-soft 0.19.0, released more
than two years ago. We're keeping the work around, because some
distros may still ship with buggy openal-soft versions and some
players may like the changed behavior. It's disabled by default.
This commit is contained in:
Yamagi 2021-01-30 13:51:02 +01:00
parent 957c11513c
commit 9a17eb9ac3
4 changed files with 34 additions and 14 deletions

View File

@ -75,6 +75,12 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
If *cl_async* is set to `0` *vid_maxfps* is the same as *cl_maxfps*,
use *cl_maxfps* to set the framerate.
* **cl_limitsparksounds**: If set to `1` the number of sound generated
when shooting into power screen and power shields is limited to 16.
This works around global volume drops in some OpenAL implementations
if too many sounds are played at the same time. This was the default
behavior between Yamagi Quake II 7.10 and 7.45. Defaults to `0`.
* **cl_loadpaused**: If set to `1` (the default) the client is put into
pause mode during single player savegame load. This prevents monsters
and the environment from hurting the player while the client is still

View File

@ -59,6 +59,7 @@ cvar_t *cl_loadpaused;
cvar_t *cl_lightlevel;
cvar_t *cl_r1q2_lightstyle;
cvar_t *cl_limitsparksounds;
/* userinfo */
cvar_t *name;
@ -526,6 +527,7 @@ CL_InitLocal(void)
cl_lightlevel = Cvar_Get("r_lightlevel", "0", 0);
cl_r1q2_lightstyle = Cvar_Get("cl_r1q2_lightstyle", "1", CVAR_ARCHIVE);
cl_limitsparksounds = Cvar_Get("cl_limitsparksounds", "0", CVAR_ARCHIVE);
/* userinfo */
name = Cvar_Get("name", "unnamed", CVAR_USERINFO | CVAR_ARCHIVE);

View File

@ -714,21 +714,32 @@ CL_ParseTEnt(void)
CL_ParticleEffect(pos, dir, 0xb0, 40);
}
num_power_sounds++;
/* If too many of these sounds are started in one frame (for
* example if the player shoots with the super shotgun into
* the power screen of a Brain) things get too loud and OpenAL
* is forced to scale the volume of several other sounds and
* the background music down. That leads to a noticable and
* annoying drop in the overall volume.
*
* Work around that by limiting the number of sounds started.
* 16 was choosen by empirical testing.
*/
if (sound_started == SS_OAL && num_power_sounds < 16)
if (cl_limitsparksounds->value)
{
S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
num_power_sounds++;
/* If too many of these sounds are started in one frame
* (for example if the player shoots with the super
* shotgun into the power screen of a Brain) things get
* too loud and OpenAL is forced to scale the volume of
* several other sounds and the background music down.
* That leads to a noticable and annoying drop in the
* overall volume.
*
* Work around that by limiting the number of sounds
* started.
* 16 was choosen by empirical testing.
*
* This was fixed in openal-soft 0.19.0. We're keeping
* the work around hidden behind a cvar and no longer
* limited to OpenAL because a) some Linux distros may
* still ship older openal-soft versions and b) some
* player may like the changed behavior.
*/
if (num_power_sounds < 16)
{
S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
}
}
break;

View File

@ -316,6 +316,7 @@ extern cvar_t *cin_force43;
extern cvar_t *vid_fullscreen;
extern cvar_t *cl_kickangles;
extern cvar_t *cl_r1q2_lightstyle;
extern cvar_t *cl_limitsparksounds;
typedef struct
{