mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-13 07:57:58 +00:00
- allow reloading the sound font for the GUS device.
This commit is contained in:
parent
e84ec2978a
commit
0688d53ea8
1 changed files with 18 additions and 1 deletions
|
@ -67,6 +67,8 @@ static int read_config_file(const char *name, bool ismain)
|
||||||
if (!(fp = pathExpander.openFileReader(name, &lumpnum)))
|
if (!(fp = pathExpander.openFileReader(name, &lumpnum)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
FreeAll();
|
||||||
|
|
||||||
if (ismain)
|
if (ismain)
|
||||||
{
|
{
|
||||||
if (lumpnum > 0)
|
if (lumpnum > 0)
|
||||||
|
@ -516,6 +518,8 @@ void FreeAll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FString currentConfig;
|
||||||
|
|
||||||
int LoadConfig(const char *filename)
|
int LoadConfig(const char *filename)
|
||||||
{
|
{
|
||||||
/* !!! FIXME: This may be ugly, but slightly less so than requiring the
|
/* !!! FIXME: This may be ugly, but slightly less so than requiring the
|
||||||
|
@ -525,6 +529,8 @@ int LoadConfig(const char *filename)
|
||||||
* file itself since that file should contain any other directory
|
* file itself since that file should contain any other directory
|
||||||
* that needs to be added to the search path.
|
* that needs to be added to the search path.
|
||||||
*/
|
*/
|
||||||
|
if (currentConfig.CompareNoCase(filename) == 0) return 0;
|
||||||
|
currentConfig = filename;
|
||||||
pathExpander.clearPathlist();
|
pathExpander.clearPathlist();
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
pathExpander.addToPathlist("C:\\TIMIDITY");
|
pathExpander.addToPathlist("C:\\TIMIDITY");
|
||||||
|
@ -560,6 +566,8 @@ int LoadConfig()
|
||||||
|
|
||||||
int LoadDMXGUS()
|
int LoadDMXGUS()
|
||||||
{
|
{
|
||||||
|
if (currentConfig.CompareNoCase("DMXGUS") == 0) return 0;
|
||||||
|
|
||||||
int lump = Wads.CheckNumForName("DMXGUS");
|
int lump = Wads.CheckNumForName("DMXGUS");
|
||||||
if (lump == -1) lump = Wads.CheckNumForName("DMXGUSC");
|
if (lump == -1) lump = Wads.CheckNumForName("DMXGUSC");
|
||||||
if (lump == -1) return LoadConfig(midi_config);
|
if (lump == -1) return LoadConfig(midi_config);
|
||||||
|
@ -567,6 +575,9 @@ int LoadDMXGUS()
|
||||||
FWadLump data = Wads.OpenLumpNum(lump);
|
FWadLump data = Wads.OpenLumpNum(lump);
|
||||||
if (data.GetLength() == 0) return LoadConfig(midi_config);
|
if (data.GetLength() == 0) return LoadConfig(midi_config);
|
||||||
|
|
||||||
|
currentConfig = "DMXGUS";
|
||||||
|
FreeAll();
|
||||||
|
|
||||||
// The GUS put its patches in %ULTRADIR%/MIDI so we can try that
|
// The GUS put its patches in %ULTRADIR%/MIDI so we can try that
|
||||||
FString ultradir = getenv("ULTRADIR");
|
FString ultradir = getenv("ULTRADIR");
|
||||||
if (ultradir.IsNotEmpty())
|
if (ultradir.IsNotEmpty())
|
||||||
|
@ -684,7 +695,13 @@ void FreeDLS(DLS_Data *data);
|
||||||
|
|
||||||
Renderer::Renderer(float sample_rate, const char *args)
|
Renderer::Renderer(float sample_rate, const char *args)
|
||||||
{
|
{
|
||||||
// 'args' should be used to load a custom config or DMXGUS, but since setup currently requires a snd_reset call, this will need some refactoring first
|
// Load explicitly stated sound font if so desired.
|
||||||
|
if (args != nullptr)
|
||||||
|
{
|
||||||
|
if (!stricmp(args, "DMXGUS")) LoadDMXGUS();
|
||||||
|
LoadConfig(args);
|
||||||
|
}
|
||||||
|
|
||||||
rate = sample_rate;
|
rate = sample_rate;
|
||||||
patches = NULL;
|
patches = NULL;
|
||||||
resample_buffer_size = 0;
|
resample_buffer_size = 0;
|
||||||
|
|
Loading…
Reference in a new issue