mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-19 07:20:50 +00:00
attempt to handle jack shutdown. this should avoid locking up on client shutdown when jack disappears
This commit is contained in:
parent
bf04589510
commit
f315a122e5
1 changed files with 23 additions and 1 deletions
|
@ -51,6 +51,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "snd_render.h"
|
||||
|
||||
static int snd_blocked = 0;
|
||||
static int snd_shutdown = 0;
|
||||
static jack_client_t *jack_handle;
|
||||
static jack_port_t *jack_out[2];
|
||||
static dma_t _snd_shm;
|
||||
|
@ -64,6 +65,20 @@ s_stop_all_sounds (void)
|
|||
SND_ScanChannels (1);
|
||||
}
|
||||
|
||||
static void
|
||||
s_update (const vec3_t origin, const vec3_t forward, const vec3_t right,
|
||||
const vec3_t up)
|
||||
{
|
||||
if (snd_shutdown) {
|
||||
if (snd_shutdown == 1) {
|
||||
snd_shutdown++;
|
||||
Sys_Printf ("Lost connection to jackd\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
SND_SetListener (origin, forward, right, up);
|
||||
}
|
||||
|
||||
static void
|
||||
s_extra_update (void)
|
||||
{
|
||||
|
@ -149,6 +164,13 @@ snd_jack_process (jack_nframes_t nframes, void *arg)
|
|||
static void
|
||||
snd_jack_shutdown (void *arg)
|
||||
{
|
||||
int i;
|
||||
channel_t *ch;
|
||||
snd_shutdown = 1;
|
||||
for (i = 0; i < MAX_CHANNELS; i++) {
|
||||
ch = &snd_channels[i];
|
||||
ch->done = ch->stop = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -219,7 +241,7 @@ static snd_render_funcs_t plugin_info_render_funcs = {
|
|||
SND_StartSound,
|
||||
SND_StopSound,
|
||||
SND_PrecacheSound,
|
||||
SND_SetListener,
|
||||
s_update,
|
||||
s_stop_all_sounds,
|
||||
s_extra_update,
|
||||
SND_LocalSound,
|
||||
|
|
Loading…
Reference in a new issue