]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_main.c
replaced Mod_LoadSkinFrame functions with R_SkinFrame system, this
[xonotic/darkplaces.git] / snd_main.c
index de35456303da36b494bae541e712efdfc45eb72b..d3f16b1193666404f169ed6f1220186df4e3e396 100644 (file)
@@ -708,7 +708,7 @@ void S_Init(void)
        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);
@@ -1403,17 +1403,20 @@ void S_UpdateAmbientSounds (void)
 
                // 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++)
@@ -1428,11 +1431,13 @@ static void S_PaintAndSubmit (void)
        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);
@@ -1501,7 +1506,7 @@ void S_Update(const matrix4x4_t *listenermatrix)
        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