cvar_t volume = {CVAR_SAVE, "volume", "0.7", "volume of sound effects"};
cvar_t snd_initialized = { CVAR_READONLY, "snd_initialized", "0", "indicates the sound subsystem is active"};
cvar_t snd_staticvolume = {CVAR_SAVE, "snd_staticvolume", "1", "volume of ambient sound effects (such as swampy sounds at the start of e1m2)"};
-cvar_t snd_soundradius = {0, "snd_soundradius", "1000", "radius of weapon sounds and other standard sound effects (monster idle noises are half this radius and flickering light noises are one third of this radius)"};
+cvar_t snd_soundradius = {0, "snd_soundradius", "2000", "radius of weapon sounds and other standard sound effects (monster idle noises are half this radius and flickering light noises are one third of this radius)"};
// Cvars declared in snd_main.h (shared with other snd_*.c files)
cvar_t _snd_mixahead = {CVAR_SAVE, "_snd_mixahead", "0.1", "how much sound to mix ahead of time"};
Cvar_RegisterVariable(&snd_channels);
// COMMANDLINEOPTION: Sound: -nosound disables sound (including CD audio)
- if (COM_CheckParm("-nosound") || COM_CheckParm("-safe"))
+ if (COM_CheckParm("-nosound"))
return;
snd_mempool = Mem_AllocPool("sound", 0, NULL);
sfx = S_FindName (serversound[i]);
if (sfx != NULL)
{
+ // clear the FILEMISSING flag so that S_LoadSound will try again on a
+ // previously missing file
+ sfx->flags &= ~ SFXFLAG_FILEMISSING;
S_LockSfx (sfx);
sfx->flags |= SFXFLAG_SERVERSOUND;
}
sfx = S_FindName (name);
+ if (sfx == NULL)
+ return NULL;
+
// clear the FILEMISSING flag so that S_LoadSound will try again on a
// previously missing file
sfx->flags &= ~ SFXFLAG_FILEMISSING;
- if (sfx == NULL)
- return NULL;
-
if (lock)
S_LockSfx (sfx);
// Don't adjust volume too fast
// FIXME: this rounds off to an int each frame, meaning there is little to no fade at extremely high framerates!
- if (chan->master_vol < vol)
- {
- chan->master_vol += (int)(cl.realframetime * ambient_fade.value);
- if (chan->master_vol > vol)
- chan->master_vol = vol;
- }
- else if (chan->master_vol > vol)
+ if (cl.time > cl.oldtime)
{
- chan->master_vol -= (int)(cl.realframetime * ambient_fade.value);
if (chan->master_vol < vol)
- chan->master_vol = vol;
+ {
+ chan->master_vol += (int)((cl.time - cl.oldtime) * ambient_fade.value);
+ if (chan->master_vol > vol)
+ chan->master_vol = vol;
+ }
+ else if (chan->master_vol > vol)
+ {
+ chan->master_vol -= (int)((cl.time - cl.oldtime) * ambient_fade.value);
+ if (chan->master_vol < vol)
+ chan->master_vol = vol;
+ }
}
for (i = 0;i < SND_LISTENERS;i++)
if (snd_renderbuffer == NULL || nosound.integer)
return;
- if (snd_blocked > 0 && !(cls.capturevideo.soundrate && !cls.capturevideo.realtime))
- return;
-
// Update sound time
- if (cls.capturevideo.soundrate && !cls.capturevideo.realtime) // SUPER NASTY HACK to record non-realtime sound
+ if (cls.timedemo) // SUPER NASTY HACK to mix non-realtime sound for more reliable benchmarking
+ newsoundtime = (unsigned int)((double)cl.mtime[0] * (double)snd_renderbuffer->format.speed);
+ else if (cls.capturevideo.soundrate && !cls.capturevideo.realtime) // SUPER NASTY HACK to record non-realtime sound
newsoundtime = (unsigned int)((double)cls.capturevideo.frame * (double)snd_renderbuffer->format.speed / (double)cls.capturevideo.framerate);
else if (simsound)
newsoundtime = (unsigned int)((realtime - snd_starttime) * (double)snd_renderbuffer->format.speed);
else
+ {
newsoundtime = SndSys_GetSoundTime();
+ if (snd_blocked > 0)
+ return;
+ }
newsoundtime += extrasoundtime;
if (newsoundtime < soundtime)
if (snd_renderbuffer == NULL || nosound.integer)
return;
- if (snd_blocked > 0 && !(cls.capturevideo.soundrate && !cls.capturevideo.realtime))
- return;
-
// If snd_swapstereo or snd_channellayout has changed, recompute the channel layout
if (current_swapstereo != snd_swapstereo.integer ||
current_channellayout != snd_channellayout.integer)