Added check for patch set existence before loading in FluidSynth

This helps to avoid flooding of output with the following messages on every MIDI song change:
fluidsynth: error: Unable to open file "/usr/share/sounds/sf2/FluidR3_GS.sf2"
fluidsynth: error: Couldn't load soundfont file
fluidsynth: error: Failed to load SoundFont "/usr/share/sounds/sf2/FluidR3_GS.sf2"
fluidsynth: error: Unable to open file "/usr/share/sounds/sf2/FluidR3_GM.sf2"
fluidsynth: error: Couldn't load soundfont file
fluidsynth: error: Failed to load SoundFont "/usr/share/sounds/sf2/FluidR3_GM.sf2"
This commit is contained in:
alexey.lysiuk 2017-05-13 17:56:26 +03:00
parent 1cd7297cd8
commit f0d40d6a8a

View file

@ -526,6 +526,8 @@ int FluidSynthMIDIDevice::LoadPatchSets(const char *patches)
{
path = NicePath(tok);
}
if (FileExists(path))
{
if (FLUID_FAILED != fluid_synth_sfload(FluidSynth, path, count == 0))
{
DPrintf(DMSG_NOTIFY, "Loaded patch set %s.\n", tok);
@ -535,6 +537,11 @@ int FluidSynthMIDIDevice::LoadPatchSets(const char *patches)
{
DPrintf(DMSG_ERROR, "Failed to load patch set %s.\n", tok);
}
}
else
{
DPrintf(DMSG_ERROR, "Could not find patch set %s.\n", tok);
}
tok = strtok(NULL, delim);
}
free(wpatches);