mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-24 04:29:34 -04:00
remove parallel sfx limit (#972)
This commit is contained in:
parent
b09678d980
commit
0ff8bdb36b
@ -406,13 +406,6 @@ default_t defaults[] = {
|
|||||||
"number of sound effects handled simultaneously"
|
"number of sound effects handled simultaneously"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
"parallel_sfx_limit",
|
|
||||||
(config_t *) ¶llel_sfx_limit, NULL,
|
|
||||||
{4}, {1, MAX_CHANNELS}, number, ss_none, wad_no,
|
|
||||||
"parallel same-sound limit (MAX_CHANNELS = disable)"
|
|
||||||
},
|
|
||||||
|
|
||||||
// [FG] music backend
|
// [FG] music backend
|
||||||
{
|
{
|
||||||
"midi_player",
|
"midi_player",
|
||||||
|
@ -212,28 +212,6 @@ static int S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source,
|
|||||||
return *vol > 0;
|
return *vol > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// S_CompareChannels
|
|
||||||
//
|
|
||||||
// A comparison function that determines which sound channel should
|
|
||||||
// take priority. Can be used with std::sort.
|
|
||||||
//
|
|
||||||
// Returns true if the first channel should precede the second.
|
|
||||||
//
|
|
||||||
static int S_CompareChannels(const void *arg_a, const void *arg_b)
|
|
||||||
{
|
|
||||||
const channel_t *a = (const channel_t *) arg_a;
|
|
||||||
const channel_t *b = (const channel_t *) arg_b;
|
|
||||||
|
|
||||||
// Note that a higher priority number means lower priority!
|
|
||||||
const int ret = a->priority - b->priority;
|
|
||||||
|
|
||||||
return ret ? ret : (b->idnum - a->idnum);
|
|
||||||
}
|
|
||||||
|
|
||||||
// How many instances of the same sfx can be playing concurrently
|
|
||||||
int parallel_sfx_limit;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// S_getChannel :
|
// S_getChannel :
|
||||||
//
|
//
|
||||||
@ -247,10 +225,6 @@ static int S_getChannel(const mobj_t *origin, sfxinfo_t *sfxinfo,
|
|||||||
{
|
{
|
||||||
// channel number to use
|
// channel number to use
|
||||||
int cnum;
|
int cnum;
|
||||||
int instances = 0;
|
|
||||||
|
|
||||||
// Sort the sound channels by descending priority levels
|
|
||||||
qsort(channels, numChannels, sizeof(channel_t), S_CompareChannels);
|
|
||||||
|
|
||||||
// haleyjd 09/28/06: moved this here. If we kill a sound already
|
// haleyjd 09/28/06: moved this here. If we kill a sound already
|
||||||
// being played, we can use that channel. There is no need to
|
// being played, we can use that channel. There is no need to
|
||||||
@ -279,23 +253,6 @@ static int S_getChannel(const mobj_t *origin, sfxinfo_t *sfxinfo,
|
|||||||
S_StopChannel(cnum);
|
S_StopChannel(cnum);
|
||||||
return cnum;
|
return cnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit the number of identical sounds playing at once
|
|
||||||
if (channels[cnum].sfxinfo == sfxinfo)
|
|
||||||
{
|
|
||||||
if (++instances >= parallel_sfx_limit)
|
|
||||||
{
|
|
||||||
if (priority < channels[cnum].priority)
|
|
||||||
{
|
|
||||||
S_StopChannel(cnum);
|
|
||||||
return cnum;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find an open channel
|
// Find an open channel
|
||||||
|
@ -66,8 +66,6 @@ typedef struct sfxinfo_struct {
|
|||||||
|
|
||||||
} sfxinfo_t;
|
} sfxinfo_t;
|
||||||
|
|
||||||
extern int parallel_sfx_limit;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// MusicInfo struct.
|
// MusicInfo struct.
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user