mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 09:22:43 +00:00
[audio] Clean up snd_render.h namespace polution
There's no need for the function typedefs and the warts on the member names were... warty. Also, group the members logically.
This commit is contained in:
parent
421421e038
commit
db322ce88b
4 changed files with 69 additions and 92 deletions
|
@ -30,54 +30,37 @@
|
||||||
#include <QF/plugin.h>
|
#include <QF/plugin.h>
|
||||||
#include <QF/qtypes.h>
|
#include <QF/qtypes.h>
|
||||||
|
|
||||||
/*
|
|
||||||
All sound plugins must export these functions
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct sfx_s;
|
struct sfx_s;
|
||||||
|
|
||||||
typedef void (*P_S_Init) (void);
|
|
||||||
typedef void (*P_S_Shutdown) (void);
|
|
||||||
typedef void (*P_S_AmbientOff) (void);
|
|
||||||
typedef void (*P_S_AmbientOn) (void);
|
|
||||||
typedef void (*P_S_StartSound) (int entnum, int entchannel, struct sfx_s *sfx, const vec3_t origin, float fvol, float attenuation);
|
|
||||||
typedef void (*P_S_StaticSound) (struct sfx_s *sfx, const vec3_t origin, float vol, float attenuation);
|
|
||||||
typedef void (*P_S_StopSound) (int entnum, int entchannel);
|
|
||||||
typedef struct sfx_s * (*P_S_PrecacheSound) (const char *sample);
|
|
||||||
typedef void (*P_S_Update) (const vec3_t origin, const vec3_t v_forward, const vec3_t v_right, const vec3_t v_up, const byte *ambient_sound_level);
|
|
||||||
typedef void (*P_S_StopAllSounds) (void);
|
|
||||||
typedef void (*P_S_ExtraUpdate) (void);
|
|
||||||
typedef void (*P_S_LocalSound) (const char *s);
|
|
||||||
typedef void (*P_S_BlockSound) (void);
|
|
||||||
typedef void (*P_S_UnblockSound) (void);
|
|
||||||
typedef struct sfx_s *(*P_S_LoadSound) (const char *name);
|
|
||||||
typedef struct channel_s *(*P_S_AllocChannel) (void);
|
|
||||||
typedef void (*P_S_ChannelStop) (struct channel_s *chan);
|
|
||||||
|
|
||||||
typedef struct snd_render_funcs_s {
|
typedef struct snd_render_funcs_s {
|
||||||
P_S_AmbientOff pS_AmbientOff;
|
void (*ambient_off) (void);
|
||||||
P_S_AmbientOn pS_AmbientOn;
|
void (*ambient_on) (void);
|
||||||
P_S_StaticSound pS_StaticSound;
|
void (*static_sound) (struct sfx_s *sfx, const vec3_t origin, float vol, float attenuation);
|
||||||
P_S_StartSound pS_StartSound;
|
void (*start_sound) (int entnum, int entchannel, struct sfx_s *sfx, const vec3_t origin, float fvol, float attenuation);
|
||||||
P_S_StopSound pS_StopSound;
|
void (*local_sound) (const char *s);
|
||||||
P_S_PrecacheSound pS_PrecacheSound;
|
void (*stop_sound) (int entnum, int entchannel);
|
||||||
P_S_Update pS_Update;
|
|
||||||
P_S_StopAllSounds pS_StopAllSounds;
|
struct channel_s *(*alloc_channel) (void);
|
||||||
P_S_ExtraUpdate pS_ExtraUpdate;
|
void (*channel_stop) (struct channel_s *chan);
|
||||||
P_S_LocalSound pS_LocalSound;
|
|
||||||
P_S_BlockSound pS_BlockSound;
|
struct sfx_s *(*precache_sound) (const char *sample);
|
||||||
P_S_UnblockSound pS_UnblockSound;
|
struct sfx_s *(*load_sound) (const char *name);
|
||||||
P_S_LoadSound pS_LoadSound;
|
|
||||||
P_S_AllocChannel pS_AllocChannel;
|
void (*update) (const vec3_t origin, const vec3_t v_forward,
|
||||||
P_S_ChannelStop pS_ChannelStop;
|
const vec3_t v_right, const vec3_t v_up,
|
||||||
|
const byte *ambient_sound_levels);
|
||||||
|
void (*stop_all_sounds) (void);
|
||||||
|
void (*extra_update) (void);
|
||||||
|
void (*block_sound) (void);
|
||||||
|
void (*unblock_sound) (void);
|
||||||
} snd_render_funcs_t;
|
} snd_render_funcs_t;
|
||||||
|
|
||||||
typedef struct snd_render_data_s {
|
typedef struct snd_render_data_s {
|
||||||
double *host_frametime;
|
double *host_frametime;
|
||||||
int *viewentity;
|
int *viewentity;
|
||||||
|
|
||||||
unsigned int *soundtime;
|
unsigned *soundtime;
|
||||||
unsigned int *paintedtime;
|
unsigned *paintedtime;
|
||||||
struct plugin_s *output;
|
struct plugin_s *output;
|
||||||
} snd_render_data_t;
|
} snd_render_data_t;
|
||||||
|
|
||||||
|
|
|
@ -362,21 +362,21 @@ static general_funcs_t plugin_info_general_funcs = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static snd_render_funcs_t plugin_info_render_funcs = {
|
static snd_render_funcs_t plugin_info_render_funcs = {
|
||||||
SND_AmbientOff,
|
.ambient_off = SND_AmbientOff,
|
||||||
SND_AmbientOn,
|
.ambient_on = SND_AmbientOn,
|
||||||
SND_StaticSound,
|
.static_sound = SND_StaticSound,
|
||||||
SND_StartSound,
|
.start_sound = SND_StartSound,
|
||||||
SND_StopSound,
|
.stop_sound = SND_StopSound,
|
||||||
SND_PrecacheSound,
|
.precache_sound = SND_PrecacheSound,
|
||||||
s_update,
|
.update = s_update,
|
||||||
s_stop_all_sounds,
|
.stop_all_sounds = s_stop_all_sounds,
|
||||||
s_extra_update,
|
.extra_update = s_extra_update,
|
||||||
SND_LocalSound,
|
.local_sound = SND_LocalSound,
|
||||||
s_block_sound,
|
.block_sound = s_block_sound,
|
||||||
s_unblock_sound,
|
.unblock_sound = s_unblock_sound,
|
||||||
SND_LoadSound,
|
.load_sound = SND_LoadSound,
|
||||||
SND_AllocChannel,
|
.alloc_channel = SND_AllocChannel,
|
||||||
SND_ChannelStop,
|
.channel_stop = SND_ChannelStop,
|
||||||
};
|
};
|
||||||
|
|
||||||
static plugin_funcs_t plugin_info_funcs = {
|
static plugin_funcs_t plugin_info_funcs = {
|
||||||
|
|
|
@ -123,11 +123,6 @@ s_update (const vec3_t origin, const vec3_t forward, const vec3_t right,
|
||||||
SND_SetListener (origin, forward, right, up, ambient_sound_level);
|
SND_SetListener (origin, forward, right, up, ambient_sound_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
s_extra_update (void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
s_local_sound (const char *sound)
|
s_local_sound (const char *sound)
|
||||||
{
|
{
|
||||||
|
@ -378,21 +373,20 @@ static general_funcs_t plugin_info_general_funcs = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static snd_render_funcs_t plugin_info_render_funcs = {
|
static snd_render_funcs_t plugin_info_render_funcs = {
|
||||||
s_ambient_off,
|
.ambient_off = s_ambient_off,
|
||||||
s_ambient_on,
|
.ambient_on = s_ambient_on,
|
||||||
s_static_sound,
|
.static_sound = s_static_sound,
|
||||||
s_start_sound,
|
.start_sound = s_start_sound,
|
||||||
s_stop_sound,
|
.stop_sound = s_stop_sound,
|
||||||
s_precache_sound,
|
.precache_sound = s_precache_sound,
|
||||||
s_update,
|
.update = s_update,
|
||||||
s_stop_all_sounds,
|
.stop_all_sounds = s_stop_all_sounds,
|
||||||
s_extra_update,
|
.local_sound = s_local_sound,
|
||||||
s_local_sound,
|
.block_sound = s_block_sound,
|
||||||
s_block_sound,
|
.unblock_sound = s_unblock_sound,
|
||||||
s_unblock_sound,
|
.load_sound = s_load_sound,
|
||||||
s_load_sound,
|
.alloc_channel = s_alloc_channel,
|
||||||
s_alloc_channel,
|
.channel_stop = s_channel_stop,
|
||||||
s_channel_stop,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static general_data_t plugin_info_general_data;
|
static general_data_t plugin_info_general_data;
|
||||||
|
|
|
@ -125,21 +125,21 @@ VISIBLE void
|
||||||
S_AmbientOff (void)
|
S_AmbientOff (void)
|
||||||
{
|
{
|
||||||
if (snd_render_funcs)
|
if (snd_render_funcs)
|
||||||
snd_render_funcs->pS_AmbientOff ();
|
snd_render_funcs->ambient_off ();
|
||||||
}
|
}
|
||||||
|
|
||||||
VISIBLE void
|
VISIBLE void
|
||||||
S_AmbientOn (void)
|
S_AmbientOn (void)
|
||||||
{
|
{
|
||||||
if (snd_render_funcs)
|
if (snd_render_funcs)
|
||||||
snd_render_funcs->pS_AmbientOn ();
|
snd_render_funcs->ambient_on ();
|
||||||
}
|
}
|
||||||
|
|
||||||
VISIBLE void
|
VISIBLE 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)
|
||||||
{
|
{
|
||||||
if (snd_render_funcs)
|
if (snd_render_funcs)
|
||||||
snd_render_funcs->pS_StaticSound (sfx, origin, vol, attenuation);
|
snd_render_funcs->static_sound (sfx, origin, vol, attenuation);
|
||||||
}
|
}
|
||||||
|
|
||||||
VISIBLE void
|
VISIBLE void
|
||||||
|
@ -147,7 +147,7 @@ S_StartSound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin,
|
||||||
float fvol, float attenuation)
|
float fvol, float attenuation)
|
||||||
{
|
{
|
||||||
if (snd_render_funcs)
|
if (snd_render_funcs)
|
||||||
snd_render_funcs->pS_StartSound (entnum, entchannel, sfx, origin, fvol,
|
snd_render_funcs->start_sound (entnum, entchannel, sfx, origin, fvol,
|
||||||
attenuation);
|
attenuation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,14 +155,14 @@ VISIBLE void
|
||||||
S_StopSound (int entnum, int entchannel)
|
S_StopSound (int entnum, int entchannel)
|
||||||
{
|
{
|
||||||
if (snd_render_funcs)
|
if (snd_render_funcs)
|
||||||
snd_render_funcs->pS_StopSound (entnum, entchannel);
|
snd_render_funcs->stop_sound (entnum, entchannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
VISIBLE sfx_t *
|
VISIBLE sfx_t *
|
||||||
S_PrecacheSound (const char *sample)
|
S_PrecacheSound (const char *sample)
|
||||||
{
|
{
|
||||||
if (snd_render_funcs)
|
if (snd_render_funcs)
|
||||||
return snd_render_funcs->pS_PrecacheSound (sample);
|
return snd_render_funcs->precache_sound (sample);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ S_Update (const vec3_t origin, const vec3_t v_forward, const vec3_t v_right,
|
||||||
const vec3_t v_up, const byte *ambient_sound_level)
|
const vec3_t v_up, const byte *ambient_sound_level)
|
||||||
{
|
{
|
||||||
if (snd_render_funcs)
|
if (snd_render_funcs)
|
||||||
snd_render_funcs->pS_Update (origin, v_forward, v_right, v_up,
|
snd_render_funcs->update (origin, v_forward, v_right, v_up,
|
||||||
ambient_sound_level);
|
ambient_sound_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,42 +179,42 @@ VISIBLE void
|
||||||
S_StopAllSounds (void)
|
S_StopAllSounds (void)
|
||||||
{
|
{
|
||||||
if (snd_render_funcs)
|
if (snd_render_funcs)
|
||||||
snd_render_funcs->pS_StopAllSounds ();
|
snd_render_funcs->stop_all_sounds ();
|
||||||
}
|
}
|
||||||
|
|
||||||
VISIBLE void
|
VISIBLE void
|
||||||
S_ExtraUpdate (void)
|
S_ExtraUpdate (void)
|
||||||
{
|
{
|
||||||
// if (snd_render_funcs)
|
if (snd_render_funcs && snd_render_funcs->extra_update)
|
||||||
// snd_render_funcs->pS_ExtraUpdate ();
|
snd_render_funcs->extra_update ();
|
||||||
}
|
}
|
||||||
|
|
||||||
VISIBLE void
|
VISIBLE void
|
||||||
S_LocalSound (const char *s)
|
S_LocalSound (const char *s)
|
||||||
{
|
{
|
||||||
if (snd_render_funcs)
|
if (snd_render_funcs)
|
||||||
snd_render_funcs->pS_LocalSound (s);
|
snd_render_funcs->local_sound (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
VISIBLE void
|
VISIBLE void
|
||||||
S_BlockSound (void)
|
S_BlockSound (void)
|
||||||
{
|
{
|
||||||
if (snd_render_funcs)
|
if (snd_render_funcs)
|
||||||
snd_render_funcs->pS_BlockSound ();
|
snd_render_funcs->block_sound ();
|
||||||
}
|
}
|
||||||
|
|
||||||
VISIBLE void
|
VISIBLE void
|
||||||
S_UnblockSound (void)
|
S_UnblockSound (void)
|
||||||
{
|
{
|
||||||
if (snd_render_funcs)
|
if (snd_render_funcs)
|
||||||
snd_render_funcs->pS_UnblockSound ();
|
snd_render_funcs->unblock_sound ();
|
||||||
}
|
}
|
||||||
|
|
||||||
VISIBLE sfx_t *
|
VISIBLE sfx_t *
|
||||||
S_LoadSound (const char *name)
|
S_LoadSound (const char *name)
|
||||||
{
|
{
|
||||||
if (snd_render_funcs)
|
if (snd_render_funcs)
|
||||||
return snd_render_funcs->pS_LoadSound (name);
|
return snd_render_funcs->load_sound (name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ VISIBLE struct channel_s *
|
||||||
S_AllocChannel (void)
|
S_AllocChannel (void)
|
||||||
{
|
{
|
||||||
if (snd_render_funcs)
|
if (snd_render_funcs)
|
||||||
return snd_render_funcs->pS_AllocChannel ();
|
return snd_render_funcs->alloc_channel ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,5 +230,5 @@ VISIBLE void
|
||||||
S_ChannelStop (struct channel_s *chan)
|
S_ChannelStop (struct channel_s *chan)
|
||||||
{
|
{
|
||||||
if (snd_render_funcs)
|
if (snd_render_funcs)
|
||||||
snd_render_funcs->pS_ChannelStop (chan);
|
snd_render_funcs->channel_stop (chan);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue