Commit 02325d2e authored by Max Kellermann's avatar Max Kellermann

decoder/fluidsynth: add "soundfont" setting

Replaces the old global "soundfont" which never worked.
parent 9c83464b
...@@ -819,6 +819,37 @@ systemctl start mpd.socket</programlisting> ...@@ -819,6 +819,37 @@ systemctl start mpd.socket</programlisting>
</section> </section>
<section> <section>
<title><varname>fluidsynth</varname></title>
<para>
MIDI decoder based on libfluidsynth.
</para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Setting</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<varname>soundfont</varname>
</entry>
<entry>
The absolute path of the soundfont file. Defaults
to
<filename>/usr/share/sounds/sf2/FluidR3_GM.sf2</filename>.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</section>
<section>
<title><varname>mikmod</varname></title> <title><varname>mikmod</varname></title>
<para> <para>
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "fluidsynth" #define G_LOG_DOMAIN "fluidsynth"
static const char *soundfont_path;
/** /**
* Convert a fluidsynth log level to a GLib log level. * Convert a fluidsynth log level to a GLib log level.
*/ */
...@@ -65,8 +67,12 @@ fluidsynth_mpd_log_function(int level, char *message, G_GNUC_UNUSED void *data) ...@@ -65,8 +67,12 @@ fluidsynth_mpd_log_function(int level, char *message, G_GNUC_UNUSED void *data)
} }
static bool static bool
fluidsynth_init(G_GNUC_UNUSED const struct config_param *param) fluidsynth_init(const struct config_param *param)
{ {
soundfont_path =
config_get_block_string(param, "soundfont",
"/usr/share/sounds/sf2/FluidR3_GM.sf2");
fluid_set_log_function(LAST_LOG_LEVEL, fluid_set_log_function(LAST_LOG_LEVEL,
fluidsynth_mpd_log_function, NULL); fluidsynth_mpd_log_function, NULL);
...@@ -86,17 +92,12 @@ fluidsynth_file_decode(struct decoder *decoder, const char *path_fs) ...@@ -86,17 +92,12 @@ fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
char setting_verbose[] = "synth.verbose"; char setting_verbose[] = "synth.verbose";
char setting_yes[] = "yes"; char setting_yes[] = "yes";
*/ */
const char *soundfont_path;
fluid_settings_t *settings; fluid_settings_t *settings;
fluid_synth_t *synth; fluid_synth_t *synth;
fluid_player_t *player; fluid_player_t *player;
int ret; int ret;
enum decoder_command cmd; enum decoder_command cmd;
soundfont_path =
config_get_string("soundfont",
"/usr/share/sounds/sf2/FluidR3_GM.sf2");
/* set up fluid settings */ /* set up fluid settings */
settings = new_fluid_settings(); settings = new_fluid_settings();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment