mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
more sound static cleanup
This commit is contained in:
parent
c0561cd834
commit
deb8137db7
5 changed files with 70 additions and 96 deletions
|
@ -101,28 +101,6 @@ struct channel_s {
|
||||||
};
|
};
|
||||||
|
|
||||||
void SND_PaintChannels(unsigned int endtime);
|
void SND_PaintChannels(unsigned int endtime);
|
||||||
void SND_Init (void);
|
|
||||||
void SND_Shutdown (void);
|
|
||||||
void SND_AmbientOff (void);
|
|
||||||
void SND_AmbientOn (void);
|
|
||||||
void SND_TouchSound (const char *sample);
|
|
||||||
void SND_ClearBuffer (void);
|
|
||||||
void SND_StaticSound (sfx_t *sfx, const vec3_t origin, float vol,
|
|
||||||
float attenuation);
|
|
||||||
void SND_StartSound (int entnum, int entchannel, sfx_t *sfx,
|
|
||||||
const vec3_t origin, float fvol, float attenuation);
|
|
||||||
void SND_StopSound (int entnum, int entchannel);
|
|
||||||
sfx_t *SND_PrecacheSound (const char *sample);
|
|
||||||
void SND_ClearPrecache (void);
|
|
||||||
void SND_Update (const vec3_t origin, const vec3_t v_forward,
|
|
||||||
const vec3_t v_right, const vec3_t v_up);
|
|
||||||
void SND_StopAllSounds (qboolean clear);
|
|
||||||
void SND_BeginPrecaching (void);
|
|
||||||
void SND_EndPrecaching (void);
|
|
||||||
void SND_ExtraUpdate (void);
|
|
||||||
void SND_LocalSound (const char *s);
|
|
||||||
void SND_BlockSound (void);
|
|
||||||
void SND_UnblockSound (void);
|
|
||||||
|
|
||||||
void SND_ResampleMono (sfxbuffer_t *sc, byte *data, int length, void *prev);
|
void SND_ResampleMono (sfxbuffer_t *sc, byte *data, int length, void *prev);
|
||||||
void SND_ResampleStereo (sfxbuffer_t *sc, byte *data, int length, void *prev);
|
void SND_ResampleStereo (sfxbuffer_t *sc, byte *data, int length, void *prev);
|
||||||
|
@ -131,10 +109,6 @@ sfxbuffer_t *SND_GetCache (long samples, int rate, int inwidth, int channels,
|
||||||
sfxblock_t *block, cache_allocator_t allocator);
|
sfxblock_t *block, cache_allocator_t allocator);
|
||||||
|
|
||||||
void SND_InitScaletable (void);
|
void SND_InitScaletable (void);
|
||||||
// picks a channel based on priorities, empty slots, number of channels
|
|
||||||
channel_t *SND_PickChannel(int entnum, int entchannel);
|
|
||||||
// spatializes a channel
|
|
||||||
void SND_Spatialize(channel_t *ch);
|
|
||||||
|
|
||||||
void SND_Load (sfx_t *sfx);
|
void SND_Load (sfx_t *sfx);
|
||||||
void SND_CallbackLoad (void *object, cache_allocator_t allocator);
|
void SND_CallbackLoad (void *object, cache_allocator_t allocator);
|
||||||
|
|
|
@ -51,8 +51,8 @@ static __attribute__ ((unused)) const char rcsid[] =
|
||||||
|
|
||||||
static int midi_intiialized = 0;
|
static int midi_intiialized = 0;
|
||||||
|
|
||||||
cvar_t * wildmidi_volume;
|
static cvar_t *wildmidi_volume;
|
||||||
cvar_t * wildmidi_config;
|
static cvar_t *wildmidi_config;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
midi_init ( void ) {
|
midi_init ( void ) {
|
||||||
|
|
|
@ -57,7 +57,6 @@ static __attribute__ ((unused)) const char rcsid[] =
|
||||||
|
|
||||||
volatile dma_t *shm = 0;
|
volatile dma_t *shm = 0;
|
||||||
unsigned int paintedtime; // sample PAIRS
|
unsigned int paintedtime; // sample PAIRS
|
||||||
qboolean snd_initialized = false;
|
|
||||||
|
|
||||||
cvar_t *snd_loadas8bit;
|
cvar_t *snd_loadas8bit;
|
||||||
cvar_t *volume;
|
cvar_t *volume;
|
||||||
|
@ -66,38 +65,39 @@ cvar_t *snd_interp;
|
||||||
channel_t channels[MAX_CHANNELS];
|
channel_t channels[MAX_CHANNELS];
|
||||||
int total_channels;
|
int total_channels;
|
||||||
|
|
||||||
int snd_blocked = 0;
|
static qboolean snd_initialized = false;
|
||||||
|
static int snd_blocked = 0;
|
||||||
static qboolean snd_ambient = 1;
|
static qboolean snd_ambient = 1;
|
||||||
|
|
||||||
vec3_t listener_origin;
|
static vec3_t listener_origin;
|
||||||
vec3_t listener_forward;
|
static vec3_t listener_forward;
|
||||||
vec3_t listener_right;
|
static vec3_t listener_right;
|
||||||
vec3_t listener_up;
|
static vec3_t listener_up;
|
||||||
vec_t sound_nominal_clip_dist = 1000.0;
|
static vec_t sound_nominal_clip_dist = 1000.0;
|
||||||
|
|
||||||
unsigned soundtime; // sample PAIRS
|
static unsigned soundtime; // sample PAIRS
|
||||||
|
|
||||||
#define MAX_SFX 512
|
#define MAX_SFX 512
|
||||||
sfx_t *known_sfx; // hunk allocated [MAX_SFX]
|
static sfx_t *known_sfx; // hunk allocated [MAX_SFX]
|
||||||
int num_sfx;
|
static int num_sfx;
|
||||||
|
|
||||||
sfx_t *ambient_sfx[NUM_AMBIENTS];
|
static sfx_t *ambient_sfx[NUM_AMBIENTS];
|
||||||
|
|
||||||
int sound_started = 0;
|
static int sound_started = 0;
|
||||||
|
|
||||||
|
|
||||||
cvar_t *ambient_fade;
|
static cvar_t *ambient_fade;
|
||||||
cvar_t *ambient_level;
|
static cvar_t *ambient_level;
|
||||||
cvar_t *nosound;
|
static cvar_t *nosound;
|
||||||
cvar_t *precache;
|
static cvar_t *precache;
|
||||||
cvar_t *snd_mixahead;
|
static cvar_t *snd_mixahead;
|
||||||
cvar_t *snd_noextraupdate;
|
static cvar_t *snd_noextraupdate;
|
||||||
cvar_t *snd_phasesep;
|
static cvar_t *snd_phasesep;
|
||||||
cvar_t *snd_show;
|
static cvar_t *snd_show;
|
||||||
cvar_t *snd_volumesep;
|
static cvar_t *snd_volumesep;
|
||||||
|
|
||||||
static general_data_t plugin_info_general_data;
|
static general_data_t plugin_info_general_data;
|
||||||
static snd_render_data_t render_data = {
|
static snd_render_data_t render_data = {
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -106,7 +106,7 @@ static snd_render_data_t render_data = {
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static snd_output_funcs_t *snd_output_funcs;
|
static snd_output_funcs_t *snd_output_funcs;
|
||||||
|
|
||||||
|
|
||||||
// User-setable variables =====================================================
|
// User-setable variables =====================================================
|
||||||
|
@ -115,17 +115,17 @@ static snd_output_funcs_t *snd_output_funcs;
|
||||||
// isolating performance in the renderer. The fakedma_updates is
|
// isolating performance in the renderer. The fakedma_updates is
|
||||||
// number of times SND_Update() is called per second.
|
// number of times SND_Update() is called per second.
|
||||||
|
|
||||||
qboolean fakedma = false;
|
static qboolean fakedma = false;
|
||||||
int fakedma_updates = 15;
|
//static int fakedma_updates = 15;
|
||||||
|
|
||||||
|
|
||||||
void
|
static void
|
||||||
SND_AmbientOff (void)
|
SND_AmbientOff (void)
|
||||||
{
|
{
|
||||||
snd_ambient = false;
|
snd_ambient = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
SND_AmbientOn (void)
|
SND_AmbientOn (void)
|
||||||
{
|
{
|
||||||
snd_ambient = true;
|
snd_ambient = true;
|
||||||
|
@ -203,7 +203,7 @@ SND_FindName (const char *name)
|
||||||
return sfx;
|
return sfx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
SND_TouchSound (const char *name)
|
SND_TouchSound (const char *name)
|
||||||
{
|
{
|
||||||
sfx_t *sfx;
|
sfx_t *sfx;
|
||||||
|
@ -215,7 +215,7 @@ SND_TouchSound (const char *name)
|
||||||
sfx->touch (sfx);
|
sfx->touch (sfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
sfx_t *
|
static sfx_t *
|
||||||
SND_PrecacheSound (const char *name)
|
SND_PrecacheSound (const char *name)
|
||||||
{
|
{
|
||||||
sfx_t *sfx;
|
sfx_t *sfx;
|
||||||
|
@ -235,7 +235,7 @@ SND_PrecacheSound (const char *name)
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
channel_t *
|
static channel_t *
|
||||||
SND_PickChannel (int entnum, int entchannel)
|
SND_PickChannel (int entnum, int entchannel)
|
||||||
{
|
{
|
||||||
int ch_idx, first_to_die;
|
int ch_idx, first_to_die;
|
||||||
|
@ -277,7 +277,7 @@ SND_PickChannel (int entnum, int entchannel)
|
||||||
return &channels[first_to_die];
|
return &channels[first_to_die];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
SND_Spatialize (channel_t *ch)
|
SND_Spatialize (channel_t *ch)
|
||||||
{
|
{
|
||||||
int phase; // in samples
|
int phase; // in samples
|
||||||
|
@ -324,7 +324,7 @@ SND_Spatialize (channel_t *ch)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start a sound effect =======================================================
|
// Start a sound effect =======================================================
|
||||||
void
|
static void
|
||||||
SND_StartSound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin,
|
SND_StartSound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin,
|
||||||
float fvol, float attenuation)
|
float fvol, float attenuation)
|
||||||
{
|
{
|
||||||
|
@ -394,7 +394,7 @@ SND_StartSound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
SND_StopSound (int entnum, int entchannel)
|
SND_StopSound (int entnum, int entchannel)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -414,7 +414,26 @@ SND_StopSound (int entnum, int entchannel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
|
SND_ClearBuffer (void)
|
||||||
|
{
|
||||||
|
int clear;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
|
||||||
|
if (!sound_started || !shm || !shm->buffer)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (shm->samplebits == 8)
|
||||||
|
clear = 0x80;
|
||||||
|
else
|
||||||
|
clear = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < shm->samples * shm->samplebits / 8; i++)
|
||||||
|
shm->buffer[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
SND_StopAllSounds (qboolean clear)
|
SND_StopAllSounds (qboolean clear)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -442,26 +461,7 @@ SND_StopAllSoundsC (void)
|
||||||
SND_StopAllSounds (true);
|
SND_StopAllSounds (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
SND_ClearBuffer (void)
|
|
||||||
{
|
|
||||||
int clear;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
|
|
||||||
if (!sound_started || !shm || !shm->buffer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (shm->samplebits == 8)
|
|
||||||
clear = 0x80;
|
|
||||||
else
|
|
||||||
clear = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < shm->samples * shm->samplebits / 8; i++)
|
|
||||||
shm->buffer[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
SND_StaticSound (sfx_t *sfx, const vec3_t origin, float vol,
|
SND_StaticSound (sfx_t *sfx, const vec3_t origin, float vol,
|
||||||
float attenuation)
|
float attenuation)
|
||||||
{
|
{
|
||||||
|
@ -618,7 +618,7 @@ SND_Update_ (void)
|
||||||
|
|
||||||
Called once each time through the main loop
|
Called once each time through the main loop
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
SND_Update (const vec3_t origin, const vec3_t forward, const vec3_t right,
|
SND_Update (const vec3_t origin, const vec3_t forward, const vec3_t right,
|
||||||
const vec3_t up)
|
const vec3_t up)
|
||||||
{
|
{
|
||||||
|
@ -697,7 +697,7 @@ SND_Update (const vec3_t origin, const vec3_t forward, const vec3_t right,
|
||||||
SND_Update_ ();
|
SND_Update_ ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
SND_ExtraUpdate (void)
|
SND_ExtraUpdate (void)
|
||||||
{
|
{
|
||||||
if (!sound_started || snd_noextraupdate->int_val)
|
if (!sound_started || snd_noextraupdate->int_val)
|
||||||
|
@ -803,7 +803,7 @@ SND_SoundList (void)
|
||||||
Sys_Printf ("Total resident: %i\n", total);
|
Sys_Printf ("Total resident: %i\n", total);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
SND_LocalSound (const char *sound)
|
SND_LocalSound (const char *sound)
|
||||||
{
|
{
|
||||||
sfx_t *sfx;
|
sfx_t *sfx;
|
||||||
|
@ -821,22 +821,22 @@ SND_LocalSound (const char *sound)
|
||||||
SND_StartSound (*render_data.viewentity, -1, sfx, vec3_origin, 1, 1);
|
SND_StartSound (*render_data.viewentity, -1, sfx, vec3_origin, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
SND_ClearPrecache (void)
|
SND_ClearPrecache (void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
SND_BeginPrecaching (void)
|
SND_BeginPrecaching (void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
SND_EndPrecaching (void)
|
SND_EndPrecaching (void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
SND_BlockSound (void)
|
SND_BlockSound (void)
|
||||||
{
|
{
|
||||||
if (++snd_blocked == 1) {
|
if (++snd_blocked == 1) {
|
||||||
|
@ -845,7 +845,7 @@ SND_BlockSound (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
SND_UnblockSound (void)
|
SND_UnblockSound (void)
|
||||||
{
|
{
|
||||||
if (!snd_blocked)
|
if (!snd_blocked)
|
||||||
|
@ -890,7 +890,7 @@ SND_Init_Cvars (void)
|
||||||
"max stereo volume separation. 1.0 is max");
|
"max stereo volume separation. 1.0 is max");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
SND_Init (void)
|
SND_Init (void)
|
||||||
{
|
{
|
||||||
snd_output_funcs = render_data.output->functions->snd_output;
|
snd_output_funcs = render_data.output->functions->snd_output;
|
||||||
|
@ -964,7 +964,7 @@ SND_Init (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown sound engine ======================================================
|
// Shutdown sound engine ======================================================
|
||||||
void
|
static void
|
||||||
SND_Shutdown (void)
|
SND_Shutdown (void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ static __attribute__ ((unused)) const char rcsid[] =
|
||||||
|
|
||||||
#define PAINTBUFFER_SIZE 512
|
#define PAINTBUFFER_SIZE 512
|
||||||
portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE * 2];
|
portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE * 2];
|
||||||
int max_overpaint; // number of extra samples painted
|
static int max_overpaint; // number of extra samples painted
|
||||||
// due to phase shift
|
// due to phase shift
|
||||||
int snd_scaletable[32][256];
|
int snd_scaletable[32][256];
|
||||||
int *snd_p, snd_linear_count, snd_vol;
|
int *snd_p, snd_linear_count, snd_vol;
|
||||||
|
|
|
@ -46,12 +46,12 @@ static plugin_t *snd_output_module = NULL;
|
||||||
static snd_render_funcs_t *snd_render_funcs = NULL;
|
static snd_render_funcs_t *snd_render_funcs = NULL;
|
||||||
|
|
||||||
SND_OUTPUT_PROTOS
|
SND_OUTPUT_PROTOS
|
||||||
plugin_list_t snd_output_list[] = {
|
static plugin_list_t snd_output_list[] = {
|
||||||
SND_OUTPUT_LIST
|
SND_OUTPUT_LIST
|
||||||
};
|
};
|
||||||
|
|
||||||
SND_RENDER_PROTOS
|
SND_RENDER_PROTOS
|
||||||
plugin_list_t snd_render_list[] = {
|
static plugin_list_t snd_render_list[] = {
|
||||||
SND_RENDER_LIST
|
SND_RENDER_LIST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue