1
0
Fork 0
forked from fte/fteqw
fteqw/quakec/menusys/menu/options_audio.qc

123 lines
6.3 KiB
C++
Raw Normal View History

static class audiomenu : mitem_exmenu
{
virtual float(string key) isvalid =
{
if (key == "sndspeed")
return super::isvalid(key) && stof(super::get("snd_mixspeed"))==44100;
return super::isvalid(key);
};
virtual string(string key) get =
{
if (key == "s_device" || key == "cl_voip_capturedevice")
{ //the cvar supports multiple options, but we only support one. :(
//so just return the first to avoid getting too confused.
tokenize(super::get(key));
return argv(0);
}
return super::get(key);
};
virtual void(string key, string val) set =
{
if (key == "s_device" || key == "cl_voip_capturedevice")
{ //add some quotes.
val = strcat("\"", val, "\"");
}
super::set(key, val);
};
};
mvd: cl_autotrack_team cvar locks autotrack to a specific team. getting the team name to match can still be problematic when it contains non-ascii chars however. qw: fix recording mid-map. q2: add support for recording demos on q2 servers. q: fix setattachment not using the correct orientations. q2: now supports splitscreen, as well as increased model and sound limits. cl: fix crosshair not appearing in splitscreen. cl: splitscreen clients now get their own colour tints (like the bf command) snd: tweak audio to be a bit more usable in splitscreen by default. cl: added con_logcenterprint cvar, for shoving a copy of centerprints onto the console. by default only appears in single player. qc: add checkbuiltin builtin. for all those #0 builtins without their own extension name. gl: fix r_dynamic -1 bug that was painfully visible in AD. mdl: validate per-frame bounds of mdl files (stuff that would crash software renderers). sv: fix -port or +sv_port commandline args to override the port correctly. win: attempt to cope with windows symlinks enumerating with the wrong filesizes. gl: fix skyboxes not appearing properly. gl: fix sprite alpha/edge issue resulting in some invisible sprites in AD. gl: fix screenshot_mega, in combination with r_projection. yay for HUGE panoramic screenshots. q2: fix replacement textures issue. qw: fix download demonum/X issue, both in client and server. qw: fix multicast dimensions not always being honoured properly. nq: fix starting angles sometimes being wrong. menusys: I'm finally uploading my menusys library, plus example mod, which I'll now be providing like csaddon is. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4997 fc73d0e0-1445-4013-8a0c-d673dee63da5
2016-01-18 05:22:07 +00:00
nonstatic void(mitem_desktop desktop) M_Options_Audio =
{
local float pos;
mitem_exmenu m;
m = spawn(audiomenu, item_text:_("Audio Options"), item_flags:IF_SELECTABLE, item_command:"m_options");
mvd: cl_autotrack_team cvar locks autotrack to a specific team. getting the team name to match can still be problematic when it contains non-ascii chars however. qw: fix recording mid-map. q2: add support for recording demos on q2 servers. q: fix setattachment not using the correct orientations. q2: now supports splitscreen, as well as increased model and sound limits. cl: fix crosshair not appearing in splitscreen. cl: splitscreen clients now get their own colour tints (like the bf command) snd: tweak audio to be a bit more usable in splitscreen by default. cl: added con_logcenterprint cvar, for shoving a copy of centerprints onto the console. by default only appears in single player. qc: add checkbuiltin builtin. for all those #0 builtins without their own extension name. gl: fix r_dynamic -1 bug that was painfully visible in AD. mdl: validate per-frame bounds of mdl files (stuff that would crash software renderers). sv: fix -port or +sv_port commandline args to override the port correctly. win: attempt to cope with windows symlinks enumerating with the wrong filesizes. gl: fix skyboxes not appearing properly. gl: fix sprite alpha/edge issue resulting in some invisible sprites in AD. gl: fix screenshot_mega, in combination with r_projection. yay for HUGE panoramic screenshots. q2: fix replacement textures issue. qw: fix download demonum/X issue, both in client and server. qw: fix multicast dimensions not always being honoured properly. nq: fix starting angles sometimes being wrong. menusys: I'm finally uploading my menusys library, plus example mod, which I'll now be providing like csaddon is. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4997 fc73d0e0-1445-4013-8a0c-d673dee63da5
2016-01-18 05:22:07 +00:00
desktop.add(m, RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MIN | RS_X_MAX_PARENT_MAX|RS_Y_MAX_PARENT_MAX, '0 0', '0 0');
desktop.item_focuschange(m, IF_KFOCUSED);
m.totop();
float h = 200 * 0.5;
//draw title art above the options
mitem_pic banner = spawn(mitem_pic, item_text:"gfx/p_option.lmp", item_size_y:24, item_flags:IF_CENTERALIGN);
m.add(banner, RS_X_MIN_PARENT_MID|RS_Y_MIN_PARENT_MID | RS_X_MAX_PARENT_MID|RS_Y_MAX_PARENT_MID, [banner.item_size_x*-0.5, -h-32], [banner.item_size_x*0.5, -h-8]);
//spawn a container frame for the actual options. this provides a scrollbar if we have too many items.
mitem_frame fr = spawn(mitem_frame, item_flags: IF_SELECTABLE, frame_hasscroll:TRUE);
m.add(fr, RS_X_MIN_PARENT_MID|RS_Y_MIN_PARENT_MID | RS_X_MAX_PARENT_MID|RS_Y_MAX_OWN_MIN, [-160, -h], [160, h*2]);
float fl = RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MIN | RS_X_MAX_PARENT_MAX|RS_Y_MAX_OWN_MIN;
pos = 0;
//add the options
fr.add(spawn(mitem_text, item_text:_("Restart Sound"), item_command:"snd_restart", item_scale:8, item_flags:IF_RIGHTALIGN), RS_X_MIN_PARENT_MIN|RS_Y_MIN_PARENT_MIN | RS_X_MAX_PARENT_MID|RS_Y_MAX_OWN_MIN, [0, pos], [-8, 8]); pos += 8;
pos += 8;
if (engine!=E_QSS)
fr.add(menuitemcombo_spawn(_("Sound Device"), "s_device", '280 8', cvar_string("_s_device_opts")), fl, [0, pos], [0, 8]); pos += 8;
fr.add(menuitemslider_spawn(_("Master Volume"), "volume", '0.0 1 0.1', '280 8'), fl, [0, pos], [0, 8]), pos += 8;
fr.add(menuitemslider_spawn(_("Ambient Volume"), "ambient_level", '0 0.5 0.05', '280 8'), fl, [0, pos], [0, 8]), pos += 8;
if (engine!=E_QSS)
fr.add(menuitemslider_spawn(_("Self Volume"), "s_localvolume", '0 1 0.1', '280 8'), fl, [0, pos], [0, 8]), pos += 8;
fr.add(menuitemslider_spawn(_("Music Volume"), "bgmvolume", '0 0.5 0.05', '280 8'), fl, [0, pos], [0, 8]), pos += 8;
if (engine!=E_QSS)
fr.add(menuitemcombo_spawn(_("Channels"), "s_numspeakers", '280 8', _(
"1 \"Mono\" "
"2 \"Stereo\" "
"4 \"Quad\" "
"6 \"Surround\" "
)), fl, [0, pos], [0, 8]), pos += 8;
if (engine==E_QSS)
fr.add(menuitemcombo_spawn(_("Audio Filtering"), "sndspeed", '280 8', _(
"\"\" \"Off\" "
"11025 \"On\" "
)), fl, [0, pos], [0, 8]), pos += 8;
fr.add(menuitemcombo_spawn(_("Audio Quality"), cv2("snd_mixspeed"/*qs*/, "s_khz"), '280 8', _(
"8000 \"8000hz (telephone quality)\" "
"11025 \"11025hz (vanilla quake)\" "
"22050 \"22050hz\" "
"44100 \"44100hz (cd quality)\" "
"48000 \"48000hz (dvd quality)\" "
//higher values are probably pointless when source data doesn't go that high, so not going to list them.
//"96000 \"96000hz (blu-ray quality)\" "
//"192000 \"192000hz (professional quality)\" "
)), fl, [0, pos], [0, 8]), pos += 8;
if (engine!=E_QSS)
fr.add(menuitemcheck_spawn(_("Doppler"), "s_doppler", '280 8'), fl, [0, pos], [0, 8]), pos += 8;
fr.add(menuitemcheck_spawn(_("8bit audio"), cv2("s_loadas8bit"/*fte*/, "loadas8bit"), '280 8'), fl, [0, pos], [0, 8]), pos += 8;
if (engine!=E_QSS)
fr.add(menuitemcheck_spawn(_("Swap Speakers"), "s_swapstereo", '280 8'), fl, [0, pos], [0, 8]), pos += 8;
fr.add(menuitemslider_spawn(_("Latency"), cv2("s_mixahead"/*fte*/, "_snd_mixahead"), '0.1 0.3 0.01', '280 8'), fl, [0, pos], [0, 8]), pos += 8;
fr.add(menuitemcheck_spawn(_("Disable Sound"), "nosound", '280 8'), fl, [0, pos], [0, 8]), pos += 8;
mvd: cl_autotrack_team cvar locks autotrack to a specific team. getting the team name to match can still be problematic when it contains non-ascii chars however. qw: fix recording mid-map. q2: add support for recording demos on q2 servers. q: fix setattachment not using the correct orientations. q2: now supports splitscreen, as well as increased model and sound limits. cl: fix crosshair not appearing in splitscreen. cl: splitscreen clients now get their own colour tints (like the bf command) snd: tweak audio to be a bit more usable in splitscreen by default. cl: added con_logcenterprint cvar, for shoving a copy of centerprints onto the console. by default only appears in single player. qc: add checkbuiltin builtin. for all those #0 builtins without their own extension name. gl: fix r_dynamic -1 bug that was painfully visible in AD. mdl: validate per-frame bounds of mdl files (stuff that would crash software renderers). sv: fix -port or +sv_port commandline args to override the port correctly. win: attempt to cope with windows symlinks enumerating with the wrong filesizes. gl: fix skyboxes not appearing properly. gl: fix sprite alpha/edge issue resulting in some invisible sprites in AD. gl: fix screenshot_mega, in combination with r_projection. yay for HUGE panoramic screenshots. q2: fix replacement textures issue. qw: fix download demonum/X issue, both in client and server. qw: fix multicast dimensions not always being honoured properly. nq: fix starting angles sometimes being wrong. menusys: I'm finally uploading my menusys library, plus example mod, which I'll now be providing like csaddon is. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4997 fc73d0e0-1445-4013-8a0c-d673dee63da5
2016-01-18 05:22:07 +00:00
//ambient fade
if (engine!=E_QSS)
fr.add(menuitemcheck_spawn(_("Static Sounds"), "cl_staticsounds", '280 8'), fl, [0, pos], [0, 8]), pos += 8;
if (engine!=E_QSS)
fr.add(menuitemcheck_spawn(_("Mix in Background"), "s_inactive", '280 8'), fl, [0, pos], [0, 8]), pos += 8;
pos += 8;
if (engine!=E_QSS)
fr.add(menuitemcombo_spawn(_("Microphone Device"), "cl_voip_capturedevice", '280 8', cvar_string("_cl_voip_capturedevice_opts")),
fl, [0, pos], [0, 8]), pos += 8;
fr.add(menuitemslider_spawn(_("VOIP Playback Vol"), "cl_voip_play", '0 2 0.1', '280 8'), fl, [0, pos], [0, 8]), pos += 8;
fr.add(menuitemcheck_spawn(_("VOIP Test"), "cl_voip_test", '280 8'), fl, [0, pos], [0, 8]), pos += 8;
fr.add(menuitemslider_spawn(_("VOIP Record Vol"), "cl_voip_micamp", '0 4 0.1', '280 8'), fl, [0, pos], [0, 8]), pos += 8;
fr.add(menuitemcombo_spawn(_("VOIP Mode"), "cl_voip_send", '280 8', _(
"0 \"Push-To-Talk\" 1 "
"\"Voice Activation\" "
"2 \"Continuous\""
)), fl, [0, pos], [0, 8]), pos += 8;
//VAD threshhold
//ducking
//noise cancelation
fr.add(menuitemcombo_spawn(_("VOIP Codec"), "cl_voip_codec", '280 8',_(
"\"\" \"Auto\" "
"0 \"speex (narrow 11khz)\" "
//"1 \"raw (wasteful)\" "
"2 \"opus\" "
"3 \"speex (narrow 8khz)\" "
"4 \"speex (wide 16khz)\" "
"5 \"speex (ultrawide 32khz)\" "
)), fl, [0, pos], [0, 8]), pos += 8;
fr.add(menuitemslider_spawn(_("Opus bitrate"), "cl_voip_bitrate", '0.5 128 0.5','280 8'), fl, [0, pos], [0, 8]), pos += 8;
mvd: cl_autotrack_team cvar locks autotrack to a specific team. getting the team name to match can still be problematic when it contains non-ascii chars however. qw: fix recording mid-map. q2: add support for recording demos on q2 servers. q: fix setattachment not using the correct orientations. q2: now supports splitscreen, as well as increased model and sound limits. cl: fix crosshair not appearing in splitscreen. cl: splitscreen clients now get their own colour tints (like the bf command) snd: tweak audio to be a bit more usable in splitscreen by default. cl: added con_logcenterprint cvar, for shoving a copy of centerprints onto the console. by default only appears in single player. qc: add checkbuiltin builtin. for all those #0 builtins without their own extension name. gl: fix r_dynamic -1 bug that was painfully visible in AD. mdl: validate per-frame bounds of mdl files (stuff that would crash software renderers). sv: fix -port or +sv_port commandline args to override the port correctly. win: attempt to cope with windows symlinks enumerating with the wrong filesizes. gl: fix skyboxes not appearing properly. gl: fix sprite alpha/edge issue resulting in some invisible sprites in AD. gl: fix screenshot_mega, in combination with r_projection. yay for HUGE panoramic screenshots. q2: fix replacement textures issue. qw: fix download demonum/X issue, both in client and server. qw: fix multicast dimensions not always being honoured properly. nq: fix starting angles sometimes being wrong. menusys: I'm finally uploading my menusys library, plus example mod, which I'll now be providing like csaddon is. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4997 fc73d0e0-1445-4013-8a0c-d673dee63da5
2016-01-18 05:22:07 +00:00
addmenuback(m);
};