- reworked the advanced sound menu to take advantage of the new soundfont handling.

The text input field for the configs have been removed. Instead it will now present a list of soundfonts that are found in specific locations.
For that it will look in the 'soundfont' directories of the FileSearch.Directories entry of the config.
Acceptable file formats here are SF2 and zipped GUS patch sets. These zipped patch sets need to have a timidity.cfg at the root and refer to all containing data by relative path. References to outside files are not allowed here.
It is still possible to refer to sound fonts elsewhere on the hard drive by manually entering a path at the console - but these won't show in the menu and will get lost if one cycles through the list of available options.
Of the available softsynths, FluidSynth will only list SF", Wildmidi will only list GUS patch sets and Timidity++ and GUS will list both.

Please note that although the GUS synth can read SF2, the output appears to be broken die to some old bug.
This commit is contained in:
Christoph Oelckers 2018-02-23 19:23:39 +01:00
parent 5da1433c57
commit 39f26028aa
5 changed files with 76 additions and 37 deletions

View File

@ -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);
}
}
//=============================================================================

View File

@ -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)

View File

@ -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);
}
}
}

View File

@ -150,3 +150,5 @@ public:
extern FSoundFontManager sfmanager;
struct FOptionValues;
void I_BuildSoundFontList(FOptionValues *opt, int allowed);

View File

@ -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"
}
/*=======================================
*