From 8662c08cdb9e697af287c6a233d2f76f81737955 Mon Sep 17 00:00:00 2001 From: drHyperion451 Date: Tue, 8 Oct 2024 21:28:06 +0100 Subject: [PATCH] New snd_filter parameter with menu options - sndspeed is now changed with snd_filter - The option is inside "game" To be done: Make it swich between "off" and "retro" or "remaster" and "classic" --- Quake/menu.c | 9 +++++++++ Quake/q_sound.h | 2 +- Quake/snd_dma.c | 8 ++++---- Quake/snd_mix.c | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Quake/menu.c b/Quake/menu.c index f109247bc..2d2d8fad4 100644 --- a/Quake/menu.c +++ b/Quake/menu.c @@ -66,6 +66,7 @@ extern cvar_t r_md5; extern cvar_t r_lerpmodels; extern cvar_t r_lerpmove; extern cvar_t snd_waterfx; +extern cvar_t snd_filter; extern cvar_t joy_deadzone_look; extern cvar_t joy_deadzone_move; extern cvar_t joy_deadzone_trigger; @@ -3239,6 +3240,7 @@ void M_Menu_Gamepad_f (void) item (SPACER, "") \ item (OPT_MUSICEXT, "External Music") \ item (OPT_WATERSNDFX, "Water Muffling") \ + item (OPT_SNDFILTER, "Sound Filter") \ end_menu () \ //////////////////////////////////////////////////////////////////////// @@ -3707,6 +3709,9 @@ void M_AdjustSliders (int dir) case OPT_WATERSNDFX: Cbuf_AddText ("toggle snd_waterfx\n"); break; + case OPT_SNDFILTER: + Cbuf_AddText ("toggle snd_filter\n"); + break; case OPT_HUDSTYLE: // hud style Cvar_SetValueQuick (&scr_hudstyle, ((int) q_max (scr_hudstyle.value, 0.f) + (int) HUD_COUNT + dir) % (int) HUD_COUNT); @@ -4354,6 +4359,10 @@ static void M_Options_DrawItem (int y, int item) M_DrawCheckbox (x, y, snd_waterfx.value); break; + case OPT_SNDFILTER: + M_DrawCheckbox (x, y, snd_filter.value); + break; + case OPT_ALWAYSRUN: if (cl_alwaysrun.value) M_Print (x, y, "QuakeSpasm"); diff --git a/Quake/q_sound.h b/Quake/q_sound.h index 2b717199d..34cb48b59 100644 --- a/Quake/q_sound.h +++ b/Quake/q_sound.h @@ -170,7 +170,7 @@ extern vec3_t listener_forward; extern vec3_t listener_right; extern vec3_t listener_up; -extern cvar_t sndspeed; +extern cvar_t snd_filter; extern cvar_t snd_mixspeed; extern cvar_t snd_filterquality; extern cvar_t sfxvolume; diff --git a/Quake/snd_dma.c b/Quake/snd_dma.c index a1203557c..91ec10f31 100644 --- a/Quake/snd_dma.c +++ b/Quake/snd_dma.c @@ -78,7 +78,7 @@ cvar_t sfxvolume = {"volume", "0.7", CVAR_ARCHIVE}; cvar_t precache = {"precache", "1", CVAR_NONE}; cvar_t loadas8bit = {"loadas8bit", "0", CVAR_NONE}; -cvar_t sndspeed = {"sndspeed", "11025", CVAR_NONE}; +cvar_t snd_filter = {"snd_filter", "0", CVAR_ARCHIVE}; cvar_t snd_mixspeed = {"snd_mixspeed", "44100", CVAR_NONE}; cvar_t snd_waterfx = {"snd_waterfx", "1", CVAR_ARCHIVE}; @@ -174,7 +174,7 @@ void S_Init (void) Cvar_RegisterVariable(&snd_noextraupdate); Cvar_RegisterVariable(&snd_show); Cvar_RegisterVariable(&_snd_mixahead); - Cvar_RegisterVariable(&sndspeed); + Cvar_RegisterVariable(&snd_filter); Cvar_RegisterVariable(&snd_mixspeed); Cvar_RegisterVariable(&snd_filterquality); Cvar_RegisterVariable(&snd_waterfx); @@ -190,10 +190,10 @@ void S_Init (void) Cmd_AddCommand("soundlist", S_SoundList); Cmd_AddCommand("soundinfo", S_SoundInfo_f); - i = COM_CheckParm("-sndspeed"); + i = COM_CheckParm("-snd_filter"); if (i && i < com_argc-1) { - Cvar_SetQuick (&sndspeed, com_argv[i + 1]); + Cvar_SetQuick (&snd_filter, com_argv[i + 1]); } i = COM_CheckParm("-mixspeed"); diff --git a/Quake/snd_mix.c b/Quake/snd_mix.c index 96f01aacd..55263f228 100644 --- a/Quake/snd_mix.c +++ b/Quake/snd_mix.c @@ -505,7 +505,7 @@ void S_PaintChannels (int endtime) } // apply a lowpass filter - if (sndspeed.value == 11025 && shm->speed == 44100) + if (snd_filter.value == 1) { static filter_t memory_l, memory_r; S_LowpassFilter((int *)paintbuffer, 2, end - paintedtime, &memory_l);