From: bones_was_here Date: Wed, 4 Sep 2024 16:39:54 +0000 (+1000) Subject: snd: remove extra updates X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=634da147e25b8e839735e4afe602daffe4688959;p=xonotic%2Fdarkplaces.git snd: remove extra updates 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 --- diff --git a/cl_main.c b/cl_main.c index 5ca74b64..fce98786 100644 --- 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++) { diff --git a/gl_rmain.c b/gl_rmain.c index 522bda3e..b14db60e 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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 6324d971..51cc1277 100644 --- 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 (); } diff --git a/r_shadow.c b/r_shadow.c index 2c5cecd3..e90cb1b7 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -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()) { diff --git a/render.h b/render.h index a2234a04..7fbcd0b3 100644 --- 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; diff --git a/snd_main.c b/snd_main.c index 781d3d67..99461943 100644 --- a/snd_main.c +++ b/snd_main.c @@ -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; diff --git a/snd_null.c b/snd_null.c index f290ed15..d808bdd6 100755 --- a/snd_null.c +++ b/snd_null.c @@ -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 5a9a72df..933e5f1c 100644 --- 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);