From 36e8257065b9e8f288410a9c2bd6ef6bb17f2779 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Sun, 5 May 2013 09:12:18 +0000 Subject: [PATCH] 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. --- fluidsynth/src/fluidsynth.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fluidsynth/src/fluidsynth.c b/fluidsynth/src/fluidsynth.c index 81d739b3..c3511f00 100644 --- a/fluidsynth/src/fluidsynth.c +++ b/fluidsynth/src/fluidsynth.c @@ -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); }