Browse Source

Give local player sounds higher-than-default priority, so its real channels won't get stolen by other entity sounds

console
Nico de Poel 5 years ago
parent
commit
2b740b33aa
  1. 6
      engine/Quake/snd_fmod.c

6
engine/Quake/snd_fmod.c

@ -276,7 +276,11 @@ void S_StartSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float f
FMOD_Channel_SetVolume(channel, fvol);
// Anything coming from the view entity will always be full volume, and entchannel -1 is used for local sounds (e.g. menu sounds)
FMOD_Channel_Set3DLevel(channel, entchannel < 0 || entnum == cl.viewentity ? 0.0f : 1.0f);
if (entchannel < 0 || entnum == cl.viewentity)
{
FMOD_Channel_Set3DLevel(channel, 0.0f);
FMOD_Channel_SetPriority(channel, 64); // Ensure local sounds always get priority over other entities
}
// Use ChannelControl::setDelay and ChannelControl::getDSPClock to add a delay to move sounds out of phase if necessary

Loading…
Cancel
Save