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);
// 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)
+ if (cl.time > cl.oldtime)
{
- chan->master_vol += (int)(cl.realframetime * ambient_fade.value);
- if (chan->master_vol > vol)
- chan->master_vol = vol;
- }
- else if (chan->master_vol > vol)
- {
- 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))
+ if (snd_blocked > 0 && !cls.timedemo && !(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);
if (snd_renderbuffer == NULL || nosound.integer)
return;
- if (snd_blocked > 0 && !(cls.capturevideo.soundrate && !cls.capturevideo.realtime))
+ if (snd_blocked > 0 && !cls.timedemo && !(cls.capturevideo.soundrate && !cls.capturevideo.realtime))
return;
// If snd_swapstereo or snd_channellayout has changed, recompute the channel layout