rename max_instances back to parallel_sfx_limit and make configurable

This commit is contained in:
Fabian Greffrath 2022-11-17 21:41:44 +01:00
parent 4ea5788c90
commit d2a411bd20
3 changed files with 11 additions and 2 deletions

View File

@ -2253,6 +2253,13 @@ default_t defaults[] = {
"1 to play sounds in full length"
},
{
"parallel_sfx_limit",
(config_t *) &parallel_sfx_limit, NULL,
{3}, {1, MAX_CHANNELS}, number, ss_none, wad_no,
"parallel same-sound limit"
},
// [FG] music backend
{
"midi_player",

View File

@ -250,7 +250,7 @@ static int S_CompareChannels(const void *arg_a, const void *arg_b)
}
// How many instances of the same sfx can be playing concurrently
static const unsigned int max_instances = 3;
int parallel_sfx_limit = 3;
//
// S_getChannel :
@ -299,7 +299,7 @@ static int S_getChannel(const mobj_t *origin, sfxinfo_t *sfxinfo,
// Limit the number of identical sounds playing at once
if (channels[cnum].sfxinfo == sfxinfo)
{
if (++instances >= max_instances)
if (++instances >= parallel_sfx_limit)
{
if (priority < channels[cnum].priority)
{

View File

@ -80,6 +80,8 @@ typedef struct sfxinfo_struct {
unsigned int alen; // length of converted sound pointed to by data
} sfxinfo_t;
extern int parallel_sfx_limit;
//
// MusicInfo struct.
//