Load default soundfont if midi files specified but no soundfont

It makes little sense to play midi files without a soundfont, so
try to load the default one in that use case.
This commit is contained in:
David Henningsson 2013-05-05 09:12:18 +00:00
parent fda26d6b24
commit 36e8257065

View file

@ -705,6 +705,16 @@ int main(int argc, char** argv)
}
if (player != NULL) {
if (fluid_synth_get_sfont(synth, 0) == NULL) {
/* Try to load the default soundfont if no soundfont specified */
char *s;
if (fluid_settings_getstr(settings, "synth.default-soundfont", &s) <= 0)
s = NULL;
if ((s != NULL) && (s[0] != '\0'))
fluid_synth_sfload(synth, s, 1);
}
fluid_player_play(player);
}