Fixed GUS Emulation with DMXGUS(C) lump conf.

- changed default value for midi_config to empty string since gus is not working with sf2 file
- fixed SetupDMXGUS not loading lump correctly, wrong use of CheckNumForFullName
- midi_config default to empty string, since lzdoom.sf2 doesn't seem supported (distorted sound)
- added absolute paths to FZipPatReader so we can add custom patches to resource files by using gus_patchdir and/or ULTRADIR variable (some custom maps has custom patches that can be added this way without putting them inside the resource file or in the same folder of the configuration file)
- set timidity_reverb_level min value to 0 in menudef.txt, set to 9 by mistake?
This commit is contained in:
Emanuele Disco 2022-04-09 03:30:10 +09:00 committed by Christoph Oelckers
parent 3d1ddbc80e
commit 71dedf6c87
5 changed files with 15 additions and 11 deletions

View file

@ -200,7 +200,8 @@ static void SetupWgOpn()
static void SetupDMXGUS()
{
int lump = fileSystem.CheckNumForFullName("DMXGUS");
int lump = fileSystem.CheckNumForName("DMXGUSC", ns_global);
if (lump < 0) lump = fileSystem.CheckNumForName("DMXGUS", ns_global);
if (lump < 0)
{
return;

View file

@ -194,6 +194,7 @@ FileReader FSF2Reader::OpenFile(const char *name)
FZipPatReader::FZipPatReader(const char *filename)
{
mAllowAbsolutePaths = true;
resf = FResourceFile::OpenResourceFile(filename, true);
}
@ -218,6 +219,7 @@ FileReader FZipPatReader::OpenFile(const char *name)
return lump->NewReader();
}
}
fr.OpenFile(name);
return fr;
}
@ -478,13 +480,6 @@ FSoundFontReader *FSoundFontManager::OpenSoundFont(const char *name, int allowed
}
}
auto sfi = FindSoundFont(name, allowed);
if (sfi != nullptr)
{
if (sfi->type == SF_SF2) return new FSF2Reader(sfi->mFilename);
else return new FZipPatReader(sfi->mFilename);
}
// The sound font collection did not yield any good results.
// Next check if the file is a .sf file
if (allowed & SF_SF2)
{
@ -500,6 +495,7 @@ FSoundFontReader *FSoundFontManager::OpenSoundFont(const char *name, int allowed
}
}
}
// Next check if the file is a resource file (it should contains gus patches and a timidity.cfg file)
if (allowed & SF_GUS)
{
FileReader fr;
@ -523,6 +519,13 @@ FSoundFontReader *FSoundFontManager::OpenSoundFont(const char *name, int allowed
return new FPatchSetReader(name);
}
}
// Lastly check in the sound font collection for a specific item or pick the first valid item available.
auto sfi = FindSoundFont(name, allowed);
if (sfi != nullptr)
{
if (sfi->type == SF_SF2) return new FSF2Reader(sfi->mFilename);
else return new FZipPatReader(sfi->mFilename);
}
return nullptr;
}

View file

@ -278,7 +278,7 @@ CUSTOM_CVAR(String, opn_custom_bank, "", CVAR_ARCHIVE | CVAR_VIRTUAL)
//==========================================================================
CUSTOM_CVAR(String, midi_config, GAMENAMELOWERCASE, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_VIRTUAL)
CUSTOM_CVAR(String, midi_config, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_VIRTUAL)
{
FORWARD_STRING_CVAR(gus_config);
}

View file

@ -1496,7 +1496,7 @@ static void InitMusicMenus()
{
DMenuDescriptor **advmenu = MenuDescriptors.CheckKey("AdvSoundOptions");
auto soundfonts = sfmanager.GetList();
std::tuple<const char *, int, const char *> sfmenus[] = { std::make_tuple("GusConfigMenu", SF_SF2 | SF_GUS, "midi_config"),
std::tuple<const char *, int, const char *> sfmenus[] = { std::make_tuple("GusConfigMenu", SF_GUS, "midi_config"),
std::make_tuple("WildMidiConfigMenu", SF_GUS, "wildmidi_config"),
std::make_tuple("TimidityConfigMenu", SF_SF2 | SF_GUS, "timidity_config"),
std::make_tuple("FluidPatchsetMenu", SF_SF2, "fluid_patchset"),

View file

@ -2103,7 +2103,7 @@ OptionMenu ModReplayerOptions protected
Title "$ADVSNDMNU_TIMIDITY"
LabeledSubMenu "$ADVSNDMNU_SELCONFIG", "timidity_config", "TimidityConfigMenu"
Option "$ADVSNDMNU_REVERB", "timidity_reverb", "TimidityReverb"
Slider "$ADVSNDMNU_REVERB_LEVEL", "timidity_reverb_level", 9, 127, 1, 0
Slider "$ADVSNDMNU_REVERB_LEVEL", "timidity_reverb_level", 0, 127, 1, 0
Option "$ADVSNDMNU_CHORUS", "timidity_chorus", "OnOff"
// other CVARs need to be revieved for usefulness
}