From b1f6417d3adfecfb47ad9b0ef5112f682335208e Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 5 Oct 2019 06:36:45 +0000 Subject: [PATCH] Add snd_ignoregamespeed cvar, optionally making it easier to desync sounds... git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5559 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/snd_dma.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engine/client/snd_dma.c b/engine/client/snd_dma.c index c2eba062a..4ed46b911 100644 --- a/engine/client/snd_dma.c +++ b/engine/client/snd_dma.c @@ -130,6 +130,7 @@ cvar_t snd_doppler_max = CVARAFD( "s_doppler_max", "2", "snd_doppler_max", CVAR_ARCHIVE, "Highest allowed doppler scale, to avoid things getting too weird."); cvar_t snd_playbackrate = CVARFD( "snd_playbackrate", "1", CVAR_CHEAT, "Debugging cvar that changes the playback rate of all new sounds."); +cvar_t snd_ignoregamespeed = CVARFD( "snd_ignoregamespeed", "0", 0, "When set, allows sounds to desynchronise with game time or demo speeds."); cvar_t snd_linearresample = CVARAF( "s_linearresample", "1", "snd_linearresample", 0); @@ -2303,6 +2304,7 @@ void S_Init (void) Cvar_Register(&snd_buffersize, "Sound controls"); Cvar_Register(&snd_samplebits, "Sound controls"); Cvar_Register(&snd_playbackrate, "Sound controls"); + Cvar_Register(&snd_ignoregamespeed, "Sound controls"); Cvar_Register(&snd_doppler, "Sound controls"); Cvar_Register(&snd_doppler_min, "Sound controls"); Cvar_Register(&snd_doppler_max, "Sound controls"); @@ -2886,11 +2888,13 @@ static void S_UpdateSoundCard(soundcardinfo_t *sc, qboolean updateonly, channel_ return; } + ratemul *= snd_playbackrate.value; + if (!snd_ignoregamespeed.ival) + ratemul *= (cls.state?cl.gamespeed:1) * (cls.demoplayback?cl_demospeed.value:1); + if (ratemul <= 0) ratemul = 1; - ratemul *= snd_playbackrate.value * (cls.state?cl.gamespeed:1) * (cls.demoplayback?cl_demospeed.value:1); - vol = fvol*255; // spatialize