diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index 39be1eea9..f8e395f1d 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -55,6 +55,7 @@ #include "types.h" #include "gameconfigfile.h" #include "m_argv.h" +#include "i_soundfont.h" @@ -1537,6 +1538,27 @@ void M_CreateMenus() { I_BuildALResamplersList(*opt); } + opt = OptionValues.CheckKey(NAME_GUSConfig); + if (opt != nullptr) + { + I_BuildSoundFontList(*opt, SF_GUS|SF_SF2); + } + opt = OptionValues.CheckKey(NAME_TimidityConfig); + if (opt != nullptr) + { + I_BuildSoundFontList(*opt, SF_GUS | SF_SF2); + } + opt = OptionValues.CheckKey(NAME_WildmidiConfig); + if (opt != nullptr) + { + I_BuildSoundFontList(*opt, SF_GUS); + } + opt = OptionValues.CheckKey(NAME_FluidConfig); + if (opt != nullptr) + { + I_BuildSoundFontList(*opt, SF_SF2); + } + } //============================================================================= diff --git a/src/namedef.h b/src/namedef.h index ace456a69..cefe54fe0 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -946,3 +946,9 @@ xx(snd_output) xx(snd_output_format) xx(snd_speakermode) xx(snd_resampler) + +// soundfont options +xx(GUSConfig) +xx(FluidConfig) +xx(TimidityConfig) +xx(WildmidiConfig) diff --git a/src/sound/i_soundfont.cpp b/src/sound/i_soundfont.cpp index 634b6448b..8434ced58 100644 --- a/src/sound/i_soundfont.cpp +++ b/src/sound/i_soundfont.cpp @@ -41,6 +41,7 @@ #include "i_system.h" #include "gameconfigfile.h" #include "resourcefiles/resourcefile.h" +#include "menu/menu.h" FSoundFontManager sfmanager; @@ -468,4 +469,25 @@ void I_InitSoundFonts() sfmanager.CollectSoundfonts(); } +//========================================================================== +// +// +// +//========================================================================== +void I_BuildSoundFontList(FOptionValues *opt, int allowed) +{ + auto &list = sfmanager.GetList(); + for (auto &entry : list) + { + if (entry.type & allowed) + { + FString display = entry.mName; + display.ReplaceChars("_", ' '); + FOptionValues::Pair pair; + pair.Text = display; + pair.TextValue = entry.mName; + opt->mValues.Push(pair); + } + } +} diff --git a/src/sound/i_soundfont.h b/src/sound/i_soundfont.h index 9208351e4..22a60683f 100644 --- a/src/sound/i_soundfont.h +++ b/src/sound/i_soundfont.h @@ -150,3 +150,5 @@ public: extern FSoundFontManager sfmanager; +struct FOptionValues; +void I_BuildSoundFontList(FOptionValues *opt, int allowed); diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 663c20ec9..97235d7b2 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1657,6 +1657,26 @@ OptionValue OplCores 3, "$OPTVAL_NUKEDOPL3" } +OptionValue GUSConfig +{ + // filled in by the sound code +} + +OptionValue WildMidiConfig +{ + // filled in by the sound code +} + +OptionValue TimidityConfig +{ + // filled in by the sound code +} + +OptionValue FluidConfig +{ + // filled in by the sound code +} + OptionMenu AdvSoundOptions protected { Title "$ADVSNDMNU_TITLE" @@ -1669,15 +1689,13 @@ OptionMenu AdvSoundOptions protected Option "$ADVSNDMNU_OPLCORES", "opl_core", "OplCores" StaticText " " StaticText "$ADVSNDMNU_GUSEMULATION", 1 - TextField "$ADVSNDMNU_GUSCONFIG", "midi_config" - SubMenu "$ADVSNDMNU_SELCONFIG", "GusConfigMenu" + Option "$ADVSNDMNU_GUSCONFIG", "midi_config", GUSConfig Slider "$ADVSNDMNU_MIDIVOICES", "midi_voices", 16, 256, 4, 0 Option "$ADVSNDMNU_DMXGUS", "midi_dmxgus", "OnOff" Option "$ADVSNDMNU_GUSMEMSIZE", "gus_memsize", "GusMemory" StaticText " " StaticText "$ADVSNDMNU_FLUIDSYNTH", 1 - TextField "$ADVSNDMNU_FLUIDPATCHSET", "fluid_patchset" - SubMenu "$ADVSNDMNU_SELCONFIG", "FluidPatchsetMenu" + Option "$ADVSNDMNU_FLUIDPATCHSET", "fluid_patchset", FluidConfig Slider "$ADVSNDMNU_FLUIDGAIN", "fluid_gain", 0, 10, 0.5, 1 Option "$ADVSNDMNU_REVERB", "fluid_reverb", "OnOff" Option "$ADVSNDMNU_CHORUS", "fluid_chorus", "OnOff" @@ -1685,46 +1703,15 @@ OptionMenu AdvSoundOptions protected // Leaving out the more advanced stuff for now. StaticText " " StaticText "$ADVSNDMNU_TIMIDITY", 1 - TextField "$ADVSNDMNU_TIMIDITYEXE", "timidity_exe" - IfOption(Windows) - { - SubMenu "$ADVSNDMNU_SELCONFIG", "TimidityExeMenu" - } - TextField "$ADVSNDMNU_TIMIDITYCONFIG", "timidity_config" - SubMenu "$ADVSNDMNU_SELCONFIG", "TimidityConfigMenu" + Option "$ADVSNDMNU_TIMIDITYCONFIG", "timidity_config", TimidityConfig Option "$ADVSNDMNU_REVERB", "timidity_reverb", "OnOff" Option "$ADVSNDMNU_CHORUS", "timidity_chorus", "OnOff" StaticText " " StaticText "$ADVSNDMNU_WILDMIDI", 1 - TextField "$ADVSNDMNU_WILDMIDICONFIG", "wildmidi_config" - SubMenu "$ADVSNDMNU_SELCONFIG", "WildMidiConfigMenu" + Option "$ADVSNDMNU_WILDMIDICONFIG", "wildmidi_config", WildmidiConfig Option "$ADVSNDMNU_REVERB", "wildmidi_reverb", "OnOff" } -OptionMenu GusConfigMenu protected -{ - Title "$ADVSNDMNU_SELCONFIG" -} - -OptionMenu WildMidiConfigMenu protected -{ - Title "$ADVSNDMNU_SELCONFIG" -} - -OptionMenu TimidityExeMenu protected -{ - Title "$ADVSNDMNU_SELCONFIG" -} - -OptionMenu TimidityConfigMenu protected -{ - Title "$ADVSNDMNU_SELCONFIG" -} - -OptionMenu FluidPatchsetMenu protected -{ - Title "$ADVSNDMNU_SELCONFIG" -} /*======================================= *