Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sound Filter options (sndspeed but more UX friendly) #343

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Quake/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 () \
////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion Quake/q_sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions Quake/snd_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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);
Expand All @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion Quake/snd_mix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down