]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
snd: remove extra updates
authorbones_was_here <bones_was_here@xonotic.au>
Wed, 4 Sep 2024 16:39:54 +0000 (02:39 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 12 Sep 2024 13:07:48 +0000 (23:07 +1000)
These are redundant now that the only audio output is via the SDL
callback which performs additonal mixing as needed.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
cl_main.c
gl_rmain.c
menu.c
r_shadow.c
render.h
snd_main.c
snd_null.c
sound.h

index 5ca74b6436f5c705a6530822e256bba9d02373e1..fce987867c73a8075dd8a267862f0c6fc74aabf5 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -2051,7 +2051,6 @@ Update client game world for a new frame
 */
 void CL_UpdateWorld(void)
 {
-       r_refdef.scene.extraupdate = !r_speeds.integer;
        r_refdef.scene.numentities = 0;
        r_refdef.scene.numlights = 0;
        r_refdef.view.matrix = identitymatrix;
@@ -2174,8 +2173,6 @@ static void CL_TimeRefresh_f(cmd_state_t *cmd)
        int i;
        double timestart, timedelta;
 
-       r_refdef.scene.extraupdate = false;
-
        timestart = Sys_DirtyTime();
        for (i = 0;i < 128;i++)
        {
index 522bda3eb87f49486b9040cb177bdb4574b72545..b14db60e7aab7f7402d57c59a9b496ba77077bc0 100644 (file)
@@ -5809,10 +5809,6 @@ void R_RenderWaterPlanes(int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *
                        R_TimeReport("waterworld");
        }
 
-       // don't let sound skip if going slow
-       if (r_refdef.scene.extraupdate)
-               S_ExtraUpdate ();
-
        R_DrawModelsAddWaterPlanes();
        if (r_timereport_active)
                R_TimeReport("watermodels");
@@ -5842,10 +5838,6 @@ void R_RenderScene(int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *viewco
 
        R_UpdateFog();
 
-       // don't let sound skip if going slow
-       if (r_refdef.scene.extraupdate)
-               S_ExtraUpdate ();
-
        R_MeshQueue_BeginScene();
 
        R_SkyStartFrame();
@@ -5857,10 +5849,6 @@ void R_RenderScene(int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *viewco
 
        if (cl.csqc_vidvars.drawworld)
        {
-               // don't let sound skip if going slow
-               if (r_refdef.scene.extraupdate)
-                       S_ExtraUpdate ();
-
                if (r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->DrawSky)
                {
                        r_refdef.scene.worldmodel->DrawSky(r_refdef.scene.worldentity);
@@ -5930,18 +5918,10 @@ void R_RenderScene(int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *viewco
                        R_TimeReport("world");
        }
 
-       // don't let sound skip if going slow
-       if (r_refdef.scene.extraupdate)
-               S_ExtraUpdate ();
-
        R_DrawModels();
        if (r_timereport_active)
                R_TimeReport("models");
 
-       // don't let sound skip if going slow
-       if (r_refdef.scene.extraupdate)
-               S_ExtraUpdate ();
-
        if (!r_shadow_usingdeferredprepass)
        {
                R_Shadow_DrawLights();
@@ -5949,10 +5929,6 @@ void R_RenderScene(int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *viewco
                        R_TimeReport("rtlights");
        }
 
-       // don't let sound skip if going slow
-       if (r_refdef.scene.extraupdate)
-               S_ExtraUpdate ();
-
        if (cl.csqc_vidvars.drawworld)
        {
                R_DrawModelDecals();
@@ -6021,10 +5997,6 @@ void R_RenderScene(int viewfbo, rtexture_t *viewdepthtexture, rtexture_t *viewco
                if (r_timereport_active)
                        R_TimeReport("coronas");
        }
-
-       // don't let sound skip if going slow
-       if (r_refdef.scene.extraupdate)
-               S_ExtraUpdate ();
 }
 
 static const unsigned short bboxelements[36] =
diff --git a/menu.c b/menu.c
index 6324d9713161fd6c3b788b3c2808410069a079ad..51cc1277e7ffffe39da98b04dedb59a062854487 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -4911,8 +4911,6 @@ void M_Draw (void)
                S_LocalSound ("sound/misc/menu2.wav");
                m_entersound = false;
        }
-
-       S_ExtraUpdate ();
 }
 
 
index 2c5cecd34b75bbf65a2017dce825bf46ede3f39b..e90cb1b749b3abe49fc584f92b10e603eb10a8b6 100644 (file)
@@ -3735,10 +3735,6 @@ static void R_Shadow_DrawLightShadowMaps(rtlight_t *rtlight)
        if (R_Shadow_ScissorForBBox(rtlight->cached_cullmins, rtlight->cached_cullmaxs))
                return;
 
-       // don't let sound skip if going slow
-       if (r_refdef.scene.extraupdate)
-               S_ExtraUpdate();
-
        numlightentities = rtlight->cached_numlightentities;
        numlightentities_noselfshadow = rtlight->cached_numlightentities_noselfshadow;
        numshadowentities = rtlight->cached_numshadowentities;
@@ -3859,10 +3855,6 @@ static void R_Shadow_DrawLight(rtlight_t *rtlight)
        if (R_Shadow_ScissorForBBox(rtlight->cached_cullmins, rtlight->cached_cullmaxs))
                return;
 
-       // don't let sound skip if going slow
-       if (r_refdef.scene.extraupdate)
-               S_ExtraUpdate();
-
        numlightentities = rtlight->cached_numlightentities;
        numlightentities_noselfshadow = rtlight->cached_numlightentities_noselfshadow;
        numsurfaces = rtlight->cached_numsurfaces;
@@ -4219,12 +4211,7 @@ void R_Shadow_DrawShadowMaps(void)
 
        // render model shadowmaps (r_shadows 2) if desired which will be sampled in the forward pass
        if (r_shadow_shadowmapatlas_modelshadows_size)
-       {
                R_Shadow_DrawModelShadowMaps();
-               // don't let sound skip if going slow
-               if (r_refdef.scene.extraupdate)
-                       S_ExtraUpdate();
-       }
 
        if (R_Shadow_ShadowMappingEnabled())
        {
index a2234a048e09de4e096a7dc07eecb158d1d93fb5..7fbcd0b35170ab61b571c90a0f29e17b880c78e1 100644 (file)
--- a/render.h
+++ b/render.h
@@ -348,9 +348,6 @@ r_refdef_viewcache_t;
 // TODO: really think about which fields should go into scene and which one should stay in refdef [1/7/2008 Black]
 // maybe also refactor some of the functions to support different setting sources (ie. fogenabled, etc.) for different scenes
 typedef struct r_refdef_scene_s {
-       /// whether to call S_ExtraUpdate during render to reduce sound chop
-       qbool extraupdate;
-
        /// (client gameworld) time for rendering time based effects
        double time;
 
index 781d3d675e00b3146e63cb3428e61a109392df44..99461943d87e6d94b5d67c3870663eaea96f52e8 100644 (file)
@@ -146,8 +146,6 @@ mempool_t *snd_mempool;
 // Linked list of known sfx
 static sfx_t *known_sfx = NULL;
 
-static qbool sound_spatialized = false;
-
 qbool simsound = false;
 
 #ifdef CONFIG_VIDEO_CAPTURE
@@ -240,7 +238,6 @@ static cvar_t nosound = {CF_CLIENT, "nosound", "0", "disables sound"};
 static cvar_t snd_precache = {CF_CLIENT, "snd_precache", "1", "loads sounds before they are used"};
 static cvar_t ambient_level = {CF_CLIENT, "ambient_level", "0.3", "volume of environment noises (water and wind)"};
 static cvar_t ambient_fade = {CF_CLIENT, "ambient_fade", "100", "rate of volume fading when moving from one environment to another"};
-static cvar_t snd_noextraupdate = {CF_CLIENT, "snd_noextraupdate", "0", "disables extra sound mixer calls that are meant to reduce the chance of sound breakup at very low framerates"};
 static cvar_t snd_show = {CF_CLIENT, "snd_show", "0", "shows some statistics about sound mixing"};
 
 // Default sound format is 48KHz, 32bit float, stereo
@@ -615,7 +612,6 @@ void S_Startup (void)
                if (!SndSys_Init(&chosen_fmt))
                {
                        Con_Print("S_Startup: SndSys_Init failed.\n");
-                       sound_spatialized = false;
                        return;
                }
        }
@@ -683,8 +679,6 @@ void S_Shutdown(void)
        }
        else
                SndSys_Shutdown();
-
-       sound_spatialized = false;
 }
 
 static void S_Restart_f(cmd_state_t *cmd)
@@ -811,7 +805,6 @@ void S_Init(void)
        Cvar_RegisterVariable(&snd_streaming_length);
        Cvar_RegisterVariable(&ambient_level);
        Cvar_RegisterVariable(&ambient_fade);
-       Cvar_RegisterVariable(&snd_noextraupdate);
        Cvar_RegisterVariable(&snd_show);
        Cvar_RegisterVariable(&snd_waterfx);
        Cvar_RegisterVariable(&_snd_mixahead);
@@ -2224,8 +2217,6 @@ void S_Update(const matrix4x4_t *listenermatrix)
        }
        R_TimeReport("audiospatialize");
 
-       sound_spatialized = true;
-
        // debugging output
        if (snd_show.integer)
                Con_Printf("----(%u)----\n", cls.soundstats.mixedsounds);
@@ -2233,14 +2224,6 @@ void S_Update(const matrix4x4_t *listenermatrix)
        S_PaintAndSubmit();
 }
 
-void S_ExtraUpdate (void)
-{
-       if (snd_noextraupdate.integer || !sound_spatialized)
-               return;
-
-       S_PaintAndSubmit();
-}
-
 qbool S_LocalSoundEx (const char *sound, int chan, float fvol)
 {
        sfx_t   *sfx;
index f290ed152546b99be1f01caf19ff91059d159479..d808bdd68e39a0395bd9ce8dde119e515ff5eba8 100755 (executable)
@@ -127,10 +127,6 @@ void S_StopAllSounds (void)
 {
 }
 
-void S_ExtraUpdate (void)
-{
-}
-
 qbool S_LocalSound (const char *s)
 {
        return false;
diff --git a/sound.h b/sound.h
index 5a9a72dfb738decd52f953ebb82446582543bc54..933e5f1c0dfbf61a727279285671e99125550872 100644 (file)
--- a/sound.h
+++ b/sound.h
@@ -67,7 +67,6 @@ void S_Shutdown (void);
 void S_UnloadAllSounds_f(struct cmd_state_s *cmd);
 
 void S_Update(const matrix4x4_t *listenermatrix);
-void S_ExtraUpdate (void);
 
 sfx_t *S_PrecacheSound (const char *sample, qbool complain, qbool levelsound);
 float S_SoundLength(const char *name);