cut some overhead on sound rendering

This commit is contained in:
Bill Currie 2003-01-31 19:14:12 +00:00
parent 570a72497f
commit 881e7918c2
4 changed files with 8 additions and 66 deletions

View file

@ -84,6 +84,7 @@ typedef struct snd_render_data_s {
int *soundtime; int *soundtime;
int *paintedtime; int *paintedtime;
struct plugin_s *output;
} snd_render_data_t; } snd_render_data_t;
#endif // __QF_plugin_snd_render_h_ #endif // __QF_plugin_snd_render_h_

View file

@ -169,15 +169,6 @@ channel_t *SND_PickChannel(int entnum, int entchannel);
// spatializes a channel // spatializes a channel
void SND_Spatialize(channel_t *ch); void SND_Spatialize(channel_t *ch);
// initializes cycling through a DMA buffer and returns information on it
qboolean S_O_Init(void);
// gets the current DMA position
int S_O_GetDMAPos(void);
// shutdown the DMA xfer.
void S_O_Shutdown(void);
// ==================================================================== // ====================================================================
// User-setable variables // User-setable variables
// ==================================================================== // ====================================================================
@ -230,10 +221,6 @@ sfxcache_t *S_LoadSound (sfx_t *s);
wavinfo_t GetWavinfo (const char *name, byte *wav, int wavlength); wavinfo_t GetWavinfo (const char *name, byte *wav, int wavlength);
void S_O_Submit(void);
void S_O_BlockSound (void);
void S_O_UnblockSound (void);
void S_AmbientOff (void); void S_AmbientOff (void);
void S_AmbientOn (void); void S_AmbientOn (void);

View file

@ -142,7 +142,7 @@ SND_Startup (void)
return; return;
if (!fakedma) { if (!fakedma) {
rc = S_O_Init (); rc = plugin_info_snd_render_data.output->functions->snd_output->pS_O_Init ();
if (!rc) { if (!rc) {
Sys_Printf ("S_Startup: S_O_Init failed.\n"); Sys_Printf ("S_Startup: S_O_Init failed.\n");
@ -545,7 +545,7 @@ SND_GetSoundtime (void)
// it is possible to miscount buffers if it has wrapped twice between // it is possible to miscount buffers if it has wrapped twice between
// calls to SND_Update. Oh well. // calls to SND_Update. Oh well.
samplepos = S_O_GetDMAPos (); samplepos = plugin_info_snd_render_data.output->functions->snd_output->pS_O_GetDMAPos ();
if (samplepos < oldsamplepos) { if (samplepos < oldsamplepos) {
buffers++; // buffer wrapped buffers++; // buffer wrapped
@ -593,7 +593,7 @@ SND_Update_ (void)
#endif #endif
SND_PaintChannels (endtime); SND_PaintChannels (endtime);
S_O_Submit (); plugin_info_snd_render_data.output->functions->snd_output->pS_O_Submit ();
} }
/* /*
@ -817,7 +817,7 @@ void
SND_BlockSound (void) SND_BlockSound (void)
{ {
if (++snd_blocked == 1) if (++snd_blocked == 1)
S_O_BlockSound (); plugin_info_snd_render_data.output->functions->snd_output->pS_O_BlockSound ();
} }
void void
@ -826,7 +826,7 @@ SND_UnblockSound (void)
if (!snd_blocked) if (!snd_blocked)
return; return;
if (!--snd_blocked) if (!--snd_blocked)
S_O_UnblockSound (); plugin_info_snd_render_data.output->functions->snd_output->pS_O_UnblockSound ();
} }
static void static void
@ -947,7 +947,7 @@ SND_Shutdown (void)
sound_started = 0; sound_started = 0;
if (!fakedma) { if (!fakedma) {
S_O_Shutdown (); plugin_info_snd_render_data.output->functions->snd_output->pS_O_Shutdown ();
} }
shm = 0; shm = 0;

View file

@ -96,6 +96,7 @@ S_Init (struct model_s **worldmodel, int *viewentity, double *host_frametime)
snd_render_module->data->snd_render->viewentity = viewentity; snd_render_module->data->snd_render->viewentity = viewentity;
snd_render_module->data->snd_render->host_frametime = snd_render_module->data->snd_render->host_frametime =
host_frametime; host_frametime;
snd_render_module->data->snd_render->output = snd_output_module;
snd_output_module->data->snd_output->soundtime snd_output_module->data->snd_output->soundtime
= snd_render_module->data->snd_render->soundtime; = snd_render_module->data->snd_render->soundtime;
@ -269,50 +270,3 @@ S_UnblockSound (void)
if (snd_render_module) if (snd_render_module)
snd_render_module->functions->snd_render->pS_UnblockSound (); snd_render_module->functions->snd_render->pS_UnblockSound ();
} }
qboolean
S_O_Init (void)
{
if (snd_output_module)
return snd_output_module->functions->snd_output->pS_O_Init ();
else
return false;
}
void
S_O_Shutdown (void)
{
if (snd_output_module)
return snd_output_module->functions->snd_output->pS_O_Shutdown ();
}
int
S_O_GetDMAPos (void)
{
if (snd_output_module)
return snd_output_module->functions->snd_output->pS_O_GetDMAPos ();
else
return 0; // FIXME: good value for this?
}
void
S_O_Submit (void)
{
if (snd_output_module)
snd_output_module->functions->snd_output->pS_O_Submit ();
}
void
S_O_BlockSound (void)
{
if (snd_output_module)
snd_output_module->functions->snd_output->pS_O_BlockSound ();
}
void
S_O_UnblockSound (void)
{
if (snd_output_module)
snd_output_module->functions->snd_output->pS_O_UnblockSound ();
}