mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 06:10:56 +00:00
cut some overhead on sound rendering
This commit is contained in:
parent
570a72497f
commit
881e7918c2
4 changed files with 8 additions and 66 deletions
|
@ -84,6 +84,7 @@ typedef struct snd_render_data_s {
|
|||
|
||||
int *soundtime;
|
||||
int *paintedtime;
|
||||
struct plugin_s *output;
|
||||
} snd_render_data_t;
|
||||
|
||||
#endif // __QF_plugin_snd_render_h_
|
||||
|
|
|
@ -169,15 +169,6 @@ channel_t *SND_PickChannel(int entnum, int entchannel);
|
|||
// spatializes a channel
|
||||
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
|
||||
// ====================================================================
|
||||
|
@ -230,10 +221,6 @@ sfxcache_t *S_LoadSound (sfx_t *s);
|
|||
|
||||
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_AmbientOn (void);
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ SND_Startup (void)
|
|||
return;
|
||||
|
||||
if (!fakedma) {
|
||||
rc = S_O_Init ();
|
||||
rc = plugin_info_snd_render_data.output->functions->snd_output->pS_O_Init ();
|
||||
|
||||
if (!rc) {
|
||||
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
|
||||
// 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) {
|
||||
buffers++; // buffer wrapped
|
||||
|
@ -593,7 +593,7 @@ SND_Update_ (void)
|
|||
#endif
|
||||
|
||||
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)
|
||||
{
|
||||
if (++snd_blocked == 1)
|
||||
S_O_BlockSound ();
|
||||
plugin_info_snd_render_data.output->functions->snd_output->pS_O_BlockSound ();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -826,7 +826,7 @@ SND_UnblockSound (void)
|
|||
if (!snd_blocked)
|
||||
return;
|
||||
if (!--snd_blocked)
|
||||
S_O_UnblockSound ();
|
||||
plugin_info_snd_render_data.output->functions->snd_output->pS_O_UnblockSound ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -947,7 +947,7 @@ SND_Shutdown (void)
|
|||
sound_started = 0;
|
||||
|
||||
if (!fakedma) {
|
||||
S_O_Shutdown ();
|
||||
plugin_info_snd_render_data.output->functions->snd_output->pS_O_Shutdown ();
|
||||
}
|
||||
|
||||
shm = 0;
|
||||
|
|
|
@ -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->host_frametime =
|
||||
host_frametime;
|
||||
snd_render_module->data->snd_render->output = snd_output_module;
|
||||
|
||||
snd_output_module->data->snd_output->soundtime
|
||||
= snd_render_module->data->snd_render->soundtime;
|
||||
|
@ -269,50 +270,3 @@ S_UnblockSound (void)
|
|||
if (snd_render_module)
|
||||
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 ();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue