[audio] Add optional on_update output function

on_update is for pull-model outpput targets to do periodic synchronous
checks (eg, checking that the connection to the actual output device is
still alive and reviving it if necessary)
This commit is contained in:
Bill Currie 2021-06-25 13:52:50 +09:00
parent db7e99d842
commit 02ff875cd6
2 changed files with 5 additions and 0 deletions

View file

@ -37,6 +37,7 @@ typedef struct snd_output_funcs_s {
void (*shutdown) (struct snd_s *snd);
int (*get_dma_pos) (struct snd_s *snd);
void (*submit) (struct snd_s *snd);
void (*on_update) (struct snd_s *snd);
void (*block_sound) (struct snd_s *snd);
void (*unblock_sound) (struct snd_s *snd);
} snd_output_funcs_t;

View file

@ -214,6 +214,10 @@ s_update (const vec3_t origin, const vec3_t forward, const vec3_t right,
if (!sound_started || (snd_blocked > 0))
return;
if (snd_output_funcs->on_update) {
snd_output_funcs->on_update (&snd);
}
SND_SetListener (&snd, origin, forward, right, up, ambient_sound_level);
if (snd_output_data->model == som_push) {