make SND_ClearBuffer get called directly by Block/UnblockSound and remove

S_ClearBuffer from the api
This commit is contained in:
Bill Currie 2003-01-31 19:55:21 +00:00
parent 881e7918c2
commit c103d77157
7 changed files with 6 additions and 19 deletions

View file

@ -42,7 +42,6 @@ typedef void (QFPLUGIN *P_S_Shutdown) (void);
typedef void (QFPLUGIN *P_S_AmbientOff) (void); typedef void (QFPLUGIN *P_S_AmbientOff) (void);
typedef void (QFPLUGIN *P_S_AmbientOn) (void); typedef void (QFPLUGIN *P_S_AmbientOn) (void);
typedef void (QFPLUGIN *P_S_TouchSound) (const char *sample); typedef void (QFPLUGIN *P_S_TouchSound) (const char *sample);
typedef void (QFPLUGIN *P_S_ClearBuffer) (void);
typedef void (QFPLUGIN *P_S_StartSound) (int entnum, int entchannel, struct sfx_s *sfx, const vec3_t origin, float fvol, float attenuation); typedef void (QFPLUGIN *P_S_StartSound) (int entnum, int entchannel, struct sfx_s *sfx, const vec3_t origin, float fvol, float attenuation);
typedef void (QFPLUGIN *P_S_StaticSound) (struct sfx_s *sfx, const vec3_t origin, float vol, float attenuation); typedef void (QFPLUGIN *P_S_StaticSound) (struct sfx_s *sfx, const vec3_t origin, float vol, float attenuation);
typedef void (QFPLUGIN *P_S_StopSound) (int entnum, int entchannel); typedef void (QFPLUGIN *P_S_StopSound) (int entnum, int entchannel);
@ -61,7 +60,6 @@ typedef struct snd_render_funcs_s {
P_S_AmbientOff pS_AmbientOff; P_S_AmbientOff pS_AmbientOff;
P_S_AmbientOn pS_AmbientOn; P_S_AmbientOn pS_AmbientOn;
P_S_TouchSound pS_TouchSound; P_S_TouchSound pS_TouchSound;
P_S_ClearBuffer pS_ClearBuffer;
P_S_StaticSound pS_StaticSound; P_S_StaticSound pS_StaticSound;
P_S_StartSound pS_StartSound; P_S_StartSound pS_StartSound;
P_S_StopSound pS_StopSound; P_S_StopSound pS_StopSound;

View file

@ -122,7 +122,6 @@ void S_StaticSound (sfx_t *sfx, const vec3_t origin, float vol,
float attenuation); float attenuation);
void S_StopSound (int entnum, int entchannel); void S_StopSound (int entnum, int entchannel);
void S_StopAllSounds(qboolean clear); void S_StopAllSounds(qboolean clear);
void S_ClearBuffer (void);
void S_Update (const vec3_t origin, const vec3_t v_forward, void S_Update (const vec3_t origin, const vec3_t v_forward,
const vec3_t v_right, const vec3_t v_up); const vec3_t v_right, const vec3_t v_up);
void S_ExtraUpdate (void); void S_ExtraUpdate (void);

View file

@ -816,8 +816,10 @@ SND_EndPrecaching (void)
void void
SND_BlockSound (void) SND_BlockSound (void)
{ {
if (++snd_blocked == 1) if (++snd_blocked == 1) {
plugin_info_snd_render_data.output->functions->snd_output->pS_O_BlockSound (); plugin_info_snd_render_data.output->functions->snd_output->pS_O_BlockSound ();
SND_ClearBuffer ();
}
} }
void void
@ -825,9 +827,11 @@ SND_UnblockSound (void)
{ {
if (!snd_blocked) if (!snd_blocked)
return; return;
if (!--snd_blocked) if (!--snd_blocked) {
SND_ClearBuffer ();
plugin_info_snd_render_data.output->functions->snd_output->pS_O_UnblockSound (); plugin_info_snd_render_data.output->functions->snd_output->pS_O_UnblockSound ();
} }
}
static void static void
SND_Init_Cvars (void) SND_Init_Cvars (void)
@ -985,7 +989,6 @@ PLUGIN_INFO(snd_render, default) (void)
plugin_info_snd_render_funcs.pS_AmbientOff = SND_AmbientOff; plugin_info_snd_render_funcs.pS_AmbientOff = SND_AmbientOff;
plugin_info_snd_render_funcs.pS_AmbientOn = SND_AmbientOn; plugin_info_snd_render_funcs.pS_AmbientOn = SND_AmbientOn;
plugin_info_snd_render_funcs.pS_TouchSound = SND_TouchSound; plugin_info_snd_render_funcs.pS_TouchSound = SND_TouchSound;
plugin_info_snd_render_funcs.pS_ClearBuffer = SND_ClearBuffer;
plugin_info_snd_render_funcs.pS_StaticSound = SND_StaticSound; plugin_info_snd_render_funcs.pS_StaticSound = SND_StaticSound;
plugin_info_snd_render_funcs.pS_StartSound = SND_StartSound; plugin_info_snd_render_funcs.pS_StartSound = SND_StartSound;
plugin_info_snd_render_funcs.pS_StopSound = SND_StopSound; plugin_info_snd_render_funcs.pS_StopSound = SND_StopSound;

View file

@ -165,13 +165,6 @@ S_TouchSound (const char *sample)
snd_render_module->functions->snd_render->pS_TouchSound (sample); snd_render_module->functions->snd_render->pS_TouchSound (sample);
} }
void
S_ClearBuffer (void)
{
if (snd_render_module)
snd_render_module->functions->snd_render->pS_ClearBuffer ();
}
void void
S_StaticSound (sfx_t *sfx, const vec3_t origin, float vol, float attenuation) S_StaticSound (sfx_t *sfx, const vec3_t origin, float vol, float attenuation)
{ {

View file

@ -57,7 +57,6 @@ event_focusout (void)
{ {
if (in_snd_block->int_val) { if (in_snd_block->int_val) {
S_BlockSound (); S_BlockSound ();
S_ClearBuffer ();
CDAudio_Pause (); CDAudio_Pause ();
} }
} }
@ -66,7 +65,6 @@ static void
event_focusin (void) event_focusin (void)
{ {
if (in_snd_block->int_val) { if (in_snd_block->int_val) {
S_ClearBuffer ();
S_UnblockSound (); S_UnblockSound ();
CDAudio_Resume (); CDAudio_Resume ();
} }

View file

@ -712,10 +712,8 @@ AppActivate (BOOL fActive, BOOL minimize)
// enable/disable sound on focus gain/loss // enable/disable sound on focus gain/loss
if (!ActiveApp && sound_active) { if (!ActiveApp && sound_active) {
S_BlockSound (); S_BlockSound ();
S_ClearBuffer ();
sound_active = false; sound_active = false;
} else if (ActiveApp && !sound_active) { } else if (ActiveApp && !sound_active) {
S_ClearBuffer ();
S_UnblockSound (); S_UnblockSound ();
sound_active = true; sound_active = true;
} }

View file

@ -483,7 +483,6 @@ event_focusout (XEvent *event)
XAutoRepeatOn (x_disp); XAutoRepeatOn (x_disp);
if (in_snd_block->int_val) { if (in_snd_block->int_val) {
S_BlockSound (); S_BlockSound ();
S_ClearBuffer ();
CDAudio_Pause (); CDAudio_Pause ();
} }
} }
@ -494,7 +493,6 @@ event_focusin (XEvent *event)
if (key_dest == key_game) if (key_dest == key_game)
XAutoRepeatOff (x_disp); XAutoRepeatOff (x_disp);
if (in_snd_block->int_val) { if (in_snd_block->int_val) {
S_ClearBuffer ();
S_UnblockSound (); S_UnblockSound ();
CDAudio_Resume (); CDAudio_Resume ();
} }