Do not allow sounds to start when we have no connection to the jack server. This fixes the shutdown hang when the connection to the server is lost.

This commit is contained in:
Bill Currie 2010-08-05 07:20:50 +00:00 committed by Jeff Teunissen
parent e9a1e5552e
commit 6e2a8f1e3d

View file

@ -65,6 +65,14 @@ s_stop_all_sounds (void)
SND_ScanChannels (1);
}
static void
s_start_sound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin,
float fvol, float attenuation)
{
if (!snd_shutdown)
SND_StartSound (entnum, entchannel, sfx, origin, fvol, attenuation);
}
static void
s_update (const vec3_t origin, const vec3_t forward, const vec3_t right,
const vec3_t up)
@ -84,6 +92,13 @@ s_extra_update (void)
{
}
static void
s_local_sound (const char *sound)
{
if (!snd_shutdown)
SND_LocalSound (sound);
}
static void
s_jack_activate (void)
{
@ -123,6 +138,14 @@ s_unblock_sound (void)
}
}
static channel_t *
s_alloc_channel (void)
{
if (!snd_shutdown)
return SND_AllocChannel ();
return 0;
}
static void
s_snd_force_unblock (void)
{
@ -238,17 +261,17 @@ static snd_render_funcs_t plugin_info_render_funcs = {
SND_AmbientOff,
SND_AmbientOn,
SND_StaticSound,
SND_StartSound,
s_start_sound,
SND_StopSound,
SND_PrecacheSound,
s_update,
s_stop_all_sounds,
s_extra_update,
SND_LocalSound,
s_local_sound,
s_block_sound,
s_unblock_sound,
SND_LoadSound,
SND_AllocChannel,
s_alloc_channel,
SND_ChannelStop,
};