Added ability to customize path to FluidSynth dynamic library

Use fluid_lib CVAR to set path or default name of dynamic library will be used instead
This commit is contained in:
alexey.lysiuk 2016-09-17 16:54:02 +03:00 committed by Christoph Oelckers
parent 4f7e1f0171
commit 0a24c15445

View file

@ -96,6 +96,8 @@
// PUBLIC DATA DEFINITIONS -------------------------------------------------
CVAR(String, fluid_lib, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR(String, fluid_patchset, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CUSTOM_CVAR(Float, fluid_gain, 0.5, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
@ -693,22 +695,54 @@ bool FluidSynthMIDIDevice::LoadFluidSynth()
const char *libname;
#ifdef _WIN32
FluidSynthDLL = LoadLibrary((libname = FLUIDSYNTHLIB1));
if (FluidSynthDLL == NULL)
if (strlen(fluid_lib) > 0)
{
FluidSynthDLL = LoadLibrary((libname = FLUIDSYNTHLIB2));
if (FluidSynthDLL == NULL)
FluidSynthDLL = LoadLibrary(libname = fluid_lib);
if (nullptr == FluidSynthDLL)
{
Printf(TEXTCOLOR_RED"Could not load " FLUIDSYNTHLIB1 " or " FLUIDSYNTHLIB2 "\n");
return false;
Printf(TEXTCOLOR_RED "Could not load %s\n", libname);
}
}
else
{
FluidSynthDLL = nullptr;
}
if (nullptr == FluidSynthDLL)
{
FluidSynthDLL = LoadLibrary(libname = FLUIDSYNTHLIB1);
if (nullptr == FluidSynthDLL)
{
FluidSynthDLL = LoadLibrary(libname = FLUIDSYNTHLIB2);
if (nullptr == FluidSynthDLL)
{
Printf(TEXTCOLOR_RED "Could not load " FLUIDSYNTHLIB1 " or " FLUIDSYNTHLIB2 "\n");
return false;
}
}
}
#else
FluidSynthSO = dlopen((libname = FLUIDSYNTHLIB), RTLD_LAZY);
if (FluidSynthSO == NULL)
if (strlen(fluid_lib) > 0)
{
Printf(TEXTCOLOR_RED"Could not load " FLUIDSYNTHLIB ": %s\n", dlerror());
return false;
FluidSynthSO = dlopen(libname = fluid_lib, RTLD_LAZY);
if (nullptr == FluidSynthSO)
{
Printf(TEXTCOLOR_RED "Could not load %s: %s\n", libname, dlerror());
}
}
else
{
FluidSynthSO = nullptr;
}
if (nullptr == FluidSynthSO)
{
FluidSynthSO = dlopen(libname = FLUIDSYNTHLIB, RTLD_LAZY);
if (nullptr == FluidSynthSO)
{
Printf(TEXTCOLOR_RED "Could not load " FLUIDSYNTHLIB ": %s\n", dlerror());
return false;
}
}
#endif