From 78184ad6b51716c0ec6b5c32fa333c8abdf5a68e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 26 Nov 2017 10:16:21 +0100 Subject: [PATCH] - more work on reverb menu. --- src/win32/eaxedit.cpp | 16 +++- wadsrc/static/menudef.txt | 82 ++++++++++--------- .../static/zscript/menu/optionmenuitems.txt | 11 ++- wadsrc/static/zscript/menu/reverbedit.txt | 41 +++++++++- 4 files changed, 101 insertions(+), 49 deletions(-) diff --git a/src/win32/eaxedit.cpp b/src/win32/eaxedit.cpp index b40b5c5486..65a7ec4e15 100644 --- a/src/win32/eaxedit.cpp +++ b/src/win32/eaxedit.cpp @@ -1427,13 +1427,14 @@ DEFINE_ACTION_FUNCTION(DReverbEdit, SetValue) PARAM_PROLOGUE; PARAM_INT(index); PARAM_FLOAT(value); - return 0; + ACTION_RETURN_FLOAT(value); + return 1; } DEFINE_ACTION_FUNCTION(DReverbEdit, GrayCheck) { PARAM_PROLOGUE; - ACTION_RETURN_BOOL(false); + ACTION_RETURN_BOOL(true); return 1; } @@ -1447,7 +1448,7 @@ DEFINE_ACTION_FUNCTION(DReverbEdit, GetSelectedEnvironment) } if (numret > 0) { - ret[0].SetString(CurrentEnv ? CurrentEnv->Name : nullptr); + ret[0].SetString(CurrentEnv ? CurrentEnv->Name : ""); } return numret; } @@ -1486,6 +1487,7 @@ CCMD(selectenvironment) if (!strcmp(env->Name, argv[1])) { CurrentEnv = env; + SavedProperties = env->Properties; if (eaxedit_test) ForcedEnvironment = env; return; } @@ -1493,3 +1495,11 @@ CCMD(selectenvironment) } CurrentEnv = nullptr; } + +CCMD(revertenvironment) +{ + if (CurrentEnv != nullptr) + { + CurrentEnv->Properties = SavedProperties; + } +} diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 47ce9fa140..ad36c71932 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -2216,7 +2216,7 @@ OptionMenu "ReverbEdit" protected StaticText " " Submenu "New Environment", "ReverbNew" Submenu "Save Environments", "ReverbSave" - Submenu "Edit Environment", "ReverbEdit" + Submenu "Edit Environment", "ReverbSettings" } OptionMenu "ReverbSelect" protected @@ -2225,41 +2225,45 @@ OptionMenu "ReverbSelect" protected Title "Select Environment" // filled in by code } - -/* - CONTROL "Reflections Scale",IDC_REFLECTIONSSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,353,70,10 - CONTROL "Reflections Delay Scale",IDC_REFLECTIONSDELAYSCALE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,366,90,10 - CONTROL "Decay Time Scale",IDC_DECAYTIMESCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,377,71,10 - CONTROL "Decay HF Limit",IDC_DECAYHFLIMIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,390,63,10 - CONTROL "Reverb Scale",IDC_REVERBSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,139,353,58,10 - CONTROL "Reverb Delay Scale",IDC_REVERBDELAYSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,139,366,78,10 - CONTROL "Echo Time Scale",IDC_ECHOTIMESCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,139,377,67,10 - CONTROL "Modulation Time Scale",IDC_MODULATIONTIMESCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,139,390,86,10 - LTEXT "Environment Size",IDC_STATIC,17,9,56,8,0,WS_EX_RIGHT - LTEXT "Environment Diffusion",IDC_STATIC,2,22,71,8,0,WS_EX_RIGHT - LTEXT "Room",IDC_STATIC,53,35,19,8,0,WS_EX_RIGHT - LTEXT "Room HF",IDC_STATIC,43,48,30,8,0,WS_EX_RIGHT - LTEXT "Room LF",IDC_STATIC,45,60,28,8,0,WS_EX_RIGHT - LTEXT "Decay Time",IDC_STATIC,35,74,38,8,0,WS_EX_RIGHT - LTEXT "Decay HF Ratio",IDC_STATIC,23,87,50,8,0,WS_EX_RIGHT - LTEXT "Decay LF Ratio",IDC_STATIC,24,100,49,8,0,WS_EX_RIGHT - LTEXT "Reflections",IDC_STATIC,37,113,36,8,0,WS_EX_RIGHT - LTEXT "Reflections Delay",IDC_STATIC,17,126,56,8,0,WS_EX_RIGHT - LTEXT "Reflections Pan X",IDC_STATIC,17,267,56,8,0,WS_EX_RIGHT - LTEXT "Reflections Pan Y",IDC_STATIC,17,280,56,8,0,WS_EX_RIGHT - LTEXT "Reflections Pan Z",IDC_STATIC,17,293,56,8,0,WS_EX_RIGHT - LTEXT "Reverb",IDC_STATIC,49,137,24,8,0,WS_EX_RIGHT - LTEXT "Reverb Delay",IDC_STATIC,29,150,44,8,0,WS_EX_RIGHT - LTEXT "Reverb Pan X",IDC_STATIC,29,306,44,8,0,WS_EX_RIGHT - LTEXT "Reverb Pan Y",IDC_STATIC,29,319,44,8,0,WS_EX_RIGHT - LTEXT "Reverb Pan Z",IDC_STATIC,29,332,44,8,0,WS_EX_RIGHT - LTEXT "Echo Time",IDC_STATIC,40,163,33,8,0,WS_EX_RIGHT - LTEXT "Echo Depth",IDC_STATIC,35,176,38,8,0,WS_EX_RIGHT - LTEXT "Modulation Time",IDC_STATIC,21,189,52,8,0,WS_EX_RIGHT - LTEXT "Modulation Depth",IDC_STATIC,16,202,57,8,0,WS_EX_RIGHT - LTEXT "Air Absorption HF",IDC_STATIC,16,215,57,8,0,WS_EX_RIGHT - LTEXT "HF Reference",IDC_STATIC,28,228,45,8,0,WS_EX_RIGHT - LTEXT "LF Reference",IDC_STATIC,29,241,44,8,0,WS_EX_RIGHT - LTEXT "Room Rolloff Factor",IDC_STATIC,9,254,64,8,0,WS_EX_RIGHT -*/ \ No newline at end of file + +OptionMenu "ReverbSettings" protected +{ + Title "Edit Reverb Environment" + SafeCommand "Revert settings", "revertenvironment" + StaticText " " + SliderReverbEditOption "Environment Size", 1, 100, 0.01, 3, 0 + SliderReverbEditOption "Environment Diffusion", 0, 10, 0.01, 3, 1 + SliderReverbEditOption "Room", -10000, 0, 1, 0, 2 + SliderReverbEditOption "Room HF", -10000, 0, 1, 0, 3 + SliderReverbEditOption "Room LF", -10000, 0, 1, 0, 4 + SliderReverbEditOption "Decay Time", 1, 200, 0.01, 3, 5 + SliderReverbEditOption "Decay HF Ratio", 1, 20, 0.01, 3, 6 + SliderReverbEditOption "Decay LF Ratio", 1, 20, 0.01, 3, 7 + SliderReverbEditOption "Reflections", -10000, 1000, 1, 0, 8 + SliderReverbEditOption "Reflections Delay", 0, 0.3, 1, 3, 9 + SliderReverbEditOption "Reflections Pan X", -2000, 2000, 1, 3, 10 + SliderReverbEditOption "Reflections Pan Y", -2000, 2000, 1, 3, 11 + SliderReverbEditOption "Reflections Pan Z", -2000, 2000, 1, 3, 12 + SliderReverbEditOption "Reverb", -10000, 2000, 1, 0, 13 + SliderReverbEditOption "Reverb Delay", 0, 0.1, 0.01, 3, 14 + SliderReverbEditOption "Reverb Pan X", -2000, 2000, 1, 3, 15 + SliderReverbEditOption "Reverb Pan Y", -2000, 2000, 1, 3, 16 + SliderReverbEditOption "Reverb Pan Z", -2000, 2000, 1, 3, 17 + SliderReverbEditOption "Echo Time", 0.075, 0.25, 0.005, 3, 18 + SliderReverbEditOption "Echo Depth", 0, 1, 0.01, 3, 19 + SliderReverbEditOption "Modulation Time", 0.04, 4, 0.01, 3, 20 + SliderReverbEditOption "Modulation Depth",0, 1, 0.01, 3, 21 + SliderReverbEditOption "Air Absorption HF", -100, 0, 0.01, 3, 22 + SliderReverbEditOption "HF Reference", 10000, 200000, 1, 3, 23 + SliderReverbEditOption "LF Reference",20, 10000, 0.1, 3, 24 + SliderReverbEditOption "Room Rolloff Factor",0, 10, 0.01, 3, 25 + StaticText " " + ReverbOption "Reflections Scale", 26, OnOff + ReverbOption "Reflections Delay Scale", 27, OnOff + ReverbOption "Decay Time Scale", 28, OnOff + ReverbOption "Decay HF Limit", 29, OnOff + ReverbOption "Reverb Scale", 30, OnOff + ReverbOption "Reverb Delay Scale", 31, OnOff + ReverbOption "Echo Time Scale", 32, OnOff + ReverbOption "Modulation Time Scale", 33, OnOff +} diff --git a/wadsrc/static/zscript/menu/optionmenuitems.txt b/wadsrc/static/zscript/menu/optionmenuitems.txt index fc9b132a98..2bedb55e06 100644 --- a/wadsrc/static/zscript/menu/optionmenuitems.txt +++ b/wadsrc/static/zscript/menu/optionmenuitems.txt @@ -250,11 +250,11 @@ class OptionMenuItemOptionBase : OptionMenuItem virtual void SetSelection(int Selection) { } - + //============================================================================= override int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected) { - bool grayed = mGrayCheck != null && !(mGrayCheck.GetInt()); + bool grayed = isGrayed(); if (mCenter) { @@ -299,10 +299,15 @@ class OptionMenuItemOptionBase : OptionMenuItem } return true; } + + virtual bool isGrayed() + { + return mGrayCheck != null && !mGrayCheck.GetInt(); + } override bool Selectable() { - return mGrayCheck == null || mGrayCheck.GetInt(); + return !isGrayed(); } } diff --git a/wadsrc/static/zscript/menu/reverbedit.txt b/wadsrc/static/zscript/menu/reverbedit.txt index c51897bdf0..7f4e655bab 100644 --- a/wadsrc/static/zscript/menu/reverbedit.txt +++ b/wadsrc/static/zscript/menu/reverbedit.txt @@ -2,7 +2,7 @@ class ReverbEdit : OptionMenu { static native double GetValue(int index); - static native void SetValue(int index, double value); + static native double SetValue(int index, double value); static native bool GrayCheck(); static native string, int GetSelectedEnvironment(); static native void FillSelectMenu(OptionMenuDescriptor desc); @@ -100,13 +100,46 @@ class OptionMenuItemReverbEditSelected : OptionMenuItemSubMenu // //============================================================================= -class OptionMenuSliderReverbEditOption : OptionMenuSliderBase +class OptionMenuItemReverbOption : OptionMenuItemOptionBase +{ + int mValIndex; + + OptionMenuItemReverbOption Init(String label, int valindex, Name values) + { + Super.Init(label, "", values, null, false); + mValIndex = valindex; + return self; + } + + override bool isGrayed() + { + return ReverbEdit.GrayCheck(); + } + + override int GetSelection() + { + return int(ReverbEdit.GetValue(mValIndex)); + } + + override void SetSelection(int Selection) + { + ReverbEdit.SetValue(mValIndex, Selection); + } +} + +//============================================================================= +// +// +// +//============================================================================= + +class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase { int mValIndex; String mEditValue; TextEnterMenu mEnter; - OptionMenuSliderReverbEditOption Init(String label, double min, double max, double step, int showval, int valindex) + OptionMenuItemSliderReverbEditOption Init(String label, double min, double max, double step, int showval, int valindex) { Super.Init(label, min, max, step, showval); mValIndex = valindex; @@ -127,7 +160,7 @@ class OptionMenuSliderReverbEditOption : OptionMenuSliderBase override bool Selectable() { - return ReverbEdit.GrayCheck(); + return !ReverbEdit.GrayCheck(); } virtual String Represent()