From 31025133b0a36fca7e7abe6fac727ab32fc7422e Mon Sep 17 00:00:00 2001 From: Tommaso Cucinotta Date: Mon, 2 May 2016 12:20:34 +0200 Subject: [PATCH 01/12] Autoconnect ALSA MIDI inputs. --- src/drivers/fluid_alsa.c | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/drivers/fluid_alsa.c b/src/drivers/fluid_alsa.c index dce95158..56e5f00b 100644 --- a/src/drivers/fluid_alsa.c +++ b/src/drivers/fluid_alsa.c @@ -128,6 +128,7 @@ static void fluid_alsa_midi_run(void* d); typedef struct { fluid_midi_driver_t driver; snd_seq_t *seq_handle; + snd_seq_port_info_t *port_info; struct pollfd *pfd; int npfd; fluid_thread_t *thread; @@ -147,9 +148,53 @@ static void fluid_alsa_seq_run(void* d); * */ +// Connect ALSA MIDI inputs to dev->port_info +static void autoconnect_inputs(fluid_alsa_seq_driver_t* dev) { + snd_seq_t *seq = dev->seq_handle; + snd_seq_port_subscribe_t *subs; + snd_seq_client_info_t *cinfo; + snd_seq_port_info_t *pinfo; + + snd_seq_port_subscribe_alloca(&subs); + snd_seq_client_info_alloca(&cinfo); + snd_seq_port_info_alloca(&pinfo); + + snd_seq_client_info_set_client(cinfo, -1); + while (snd_seq_query_next_client(seq, cinfo) >= 0) { + const snd_seq_addr_t *dest = snd_seq_port_info_get_addr(dev->port_info); + + snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo)); + snd_seq_port_info_set_port(pinfo, -1); + while (snd_seq_query_next_port(seq, pinfo) >= 0) { + unsigned int needed_type = SND_SEQ_PORT_TYPE_MIDI_GENERIC; + if ((snd_seq_port_info_get_type(pinfo) & needed_type) != needed_type) + continue; + unsigned int needed_cap = SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ; + if ((snd_seq_port_info_get_capability(pinfo) & needed_cap) != needed_cap) + continue; + const snd_seq_addr_t *sender = snd_seq_port_info_get_addr(pinfo); + const char *pname = snd_seq_port_info_get_name(pinfo); + + snd_seq_port_subscribe_set_sender(subs, sender); + snd_seq_port_subscribe_set_dest(subs, dest); + + if (snd_seq_get_port_subscription(seq, subs) == 0) { + fprintf(stderr, _("Connection %s is already subscribed\n"), pname); + continue; + } + if (snd_seq_subscribe_port(seq, subs) < 0) { + fprintf(stderr, _("Connection of %s failed (%s)\n"), pname, snd_strerror(errno)); + continue; + } + fprintf(stderr, _("Connection of %s succeeded\n"), pname); + } + } +} + void fluid_alsa_audio_driver_settings(fluid_settings_t* settings) { fluid_settings_register_str(settings, "audio.alsa.device", "default", 0, NULL, NULL); + fluid_settings_register_int(settings, "audio.alsa.autoconnect_inputs", 0, 0, 1, FLUID_HINT_TOGGLED, NULL, NULL); } @@ -889,6 +934,13 @@ new_fluid_alsa_seq_driver(fluid_settings_t* settings, } } + dev->port_info = port_info; + + int autoconn_inputs = 0; + fluid_settings_getint(settings, "audio.alsa.autoconnect_inputs", &autoconn_inputs); + if (autoconn_inputs) + autoconnect_inputs(dev); + /* tell the lash server our client id */ #ifdef LASH_ENABLED { From ae660ebcdb8a38fc08dcdfb2b9839ccb382c5fe0 Mon Sep 17 00:00:00 2001 From: derselbst Date: Wed, 25 Oct 2017 16:49:56 +0200 Subject: [PATCH 02/12] rename alsa autoconnect setting to fit conventions --- src/drivers/fluid_alsa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/fluid_alsa.c b/src/drivers/fluid_alsa.c index 56e5f00b..99eebc8a 100644 --- a/src/drivers/fluid_alsa.c +++ b/src/drivers/fluid_alsa.c @@ -194,7 +194,7 @@ static void autoconnect_inputs(fluid_alsa_seq_driver_t* dev) { void fluid_alsa_audio_driver_settings(fluid_settings_t* settings) { fluid_settings_register_str(settings, "audio.alsa.device", "default", 0, NULL, NULL); - fluid_settings_register_int(settings, "audio.alsa.autoconnect_inputs", 0, 0, 1, FLUID_HINT_TOGGLED, NULL, NULL); + fluid_settings_register_int(settings, "audio.alsa.autoconnect", 0, 0, 1, FLUID_HINT_TOGGLED, NULL, NULL); } @@ -937,7 +937,7 @@ new_fluid_alsa_seq_driver(fluid_settings_t* settings, dev->port_info = port_info; int autoconn_inputs = 0; - fluid_settings_getint(settings, "audio.alsa.autoconnect_inputs", &autoconn_inputs); + fluid_settings_getint(settings, "audio.alsa.autoconnect", &autoconn_inputs); if (autoconn_inputs) autoconnect_inputs(dev); From aa33bd23c0e54fb9d60c1a5b6aa5004919fa81bd Mon Sep 17 00:00:00 2001 From: derselbst Date: Wed, 25 Oct 2017 16:51:29 +0200 Subject: [PATCH 03/12] avoid mixed declarations --- src/drivers/fluid_alsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/fluid_alsa.c b/src/drivers/fluid_alsa.c index 99eebc8a..ad85e68c 100644 --- a/src/drivers/fluid_alsa.c +++ b/src/drivers/fluid_alsa.c @@ -805,6 +805,7 @@ new_fluid_alsa_seq_driver(fluid_settings_t* settings, handle_midi_event_func_t handler, void* data) { int i, err; + int autoconn_inputs = 0; fluid_alsa_seq_driver_t* dev; int realtime_prio = 0; int count; @@ -936,7 +937,6 @@ new_fluid_alsa_seq_driver(fluid_settings_t* settings, dev->port_info = port_info; - int autoconn_inputs = 0; fluid_settings_getint(settings, "audio.alsa.autoconnect", &autoconn_inputs); if (autoconn_inputs) autoconnect_inputs(dev); From bb00ce7b256d1d288c656e457ab9eb3aebcb7826 Mon Sep 17 00:00:00 2001 From: derselbst Date: Wed, 25 Oct 2017 16:52:37 +0200 Subject: [PATCH 04/12] rename alsa_autoconnect function to fit conventions --- src/drivers/fluid_alsa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/fluid_alsa.c b/src/drivers/fluid_alsa.c index ad85e68c..ddeaf43b 100644 --- a/src/drivers/fluid_alsa.c +++ b/src/drivers/fluid_alsa.c @@ -149,7 +149,7 @@ static void fluid_alsa_seq_run(void* d); */ // Connect ALSA MIDI inputs to dev->port_info -static void autoconnect_inputs(fluid_alsa_seq_driver_t* dev) { +static void fluid_alsa_autoconnect_inputs(fluid_alsa_seq_driver_t* dev) { snd_seq_t *seq = dev->seq_handle; snd_seq_port_subscribe_t *subs; snd_seq_client_info_t *cinfo; @@ -939,7 +939,7 @@ new_fluid_alsa_seq_driver(fluid_settings_t* settings, fluid_settings_getint(settings, "audio.alsa.autoconnect", &autoconn_inputs); if (autoconn_inputs) - autoconnect_inputs(dev); + fluid_alsa_autoconnect_inputs(dev); /* tell the lash server our client id */ #ifdef LASH_ENABLED From 22c38a4205e904674ef4b98a07147fd343c49e41 Mon Sep 17 00:00:00 2001 From: derselbst Date: Wed, 25 Oct 2017 16:56:06 +0200 Subject: [PATCH 05/12] avoid storing pointer to stack alloced var --- src/drivers/fluid_alsa.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/drivers/fluid_alsa.c b/src/drivers/fluid_alsa.c index ddeaf43b..77daba8a 100644 --- a/src/drivers/fluid_alsa.c +++ b/src/drivers/fluid_alsa.c @@ -128,7 +128,6 @@ static void fluid_alsa_midi_run(void* d); typedef struct { fluid_midi_driver_t driver; snd_seq_t *seq_handle; - snd_seq_port_info_t *port_info; struct pollfd *pfd; int npfd; fluid_thread_t *thread; @@ -148,8 +147,9 @@ static void fluid_alsa_seq_run(void* d); * */ -// Connect ALSA MIDI inputs to dev->port_info -static void fluid_alsa_autoconnect_inputs(fluid_alsa_seq_driver_t* dev) { +// Connect ALSA MIDI inputs to port_info +static void fluid_alsa_autoconnect_inputs(fluid_alsa_seq_driver_t* dev, const snd_seq_port_info_t *port_info) +{ snd_seq_t *seq = dev->seq_handle; snd_seq_port_subscribe_t *subs; snd_seq_client_info_t *cinfo; @@ -161,7 +161,7 @@ static void fluid_alsa_autoconnect_inputs(fluid_alsa_seq_driver_t* dev) { snd_seq_client_info_set_client(cinfo, -1); while (snd_seq_query_next_client(seq, cinfo) >= 0) { - const snd_seq_addr_t *dest = snd_seq_port_info_get_addr(dev->port_info); + const snd_seq_addr_t *dest = snd_seq_port_info_get_addr(port_info); snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo)); snd_seq_port_info_set_port(pinfo, -1); @@ -935,11 +935,9 @@ new_fluid_alsa_seq_driver(fluid_settings_t* settings, } } - dev->port_info = port_info; - fluid_settings_getint(settings, "audio.alsa.autoconnect", &autoconn_inputs); if (autoconn_inputs) - fluid_alsa_autoconnect_inputs(dev); + fluid_alsa_autoconnect_inputs(dev, port_info); /* tell the lash server our client id */ #ifdef LASH_ENABLED From 7a3a97a98e977a7ed83e9d1bf34522a44a8a3baf Mon Sep 17 00:00:00 2001 From: derselbst Date: Wed, 25 Oct 2017 16:57:15 +0200 Subject: [PATCH 06/12] even more mixed declarations --- src/drivers/fluid_alsa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/drivers/fluid_alsa.c b/src/drivers/fluid_alsa.c index 77daba8a..53dcb533 100644 --- a/src/drivers/fluid_alsa.c +++ b/src/drivers/fluid_alsa.c @@ -167,13 +167,13 @@ static void fluid_alsa_autoconnect_inputs(fluid_alsa_seq_driver_t* dev, const sn snd_seq_port_info_set_port(pinfo, -1); while (snd_seq_query_next_port(seq, pinfo) >= 0) { unsigned int needed_type = SND_SEQ_PORT_TYPE_MIDI_GENERIC; - if ((snd_seq_port_info_get_type(pinfo) & needed_type) != needed_type) - continue; unsigned int needed_cap = SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ; - if ((snd_seq_port_info_get_capability(pinfo) & needed_cap) != needed_cap) - continue; const snd_seq_addr_t *sender = snd_seq_port_info_get_addr(pinfo); const char *pname = snd_seq_port_info_get_name(pinfo); + if ((snd_seq_port_info_get_type(pinfo) & needed_type) != needed_type) + continue; + if ((snd_seq_port_info_get_capability(pinfo) & needed_cap) != needed_cap) + continue; snd_seq_port_subscribe_set_sender(subs, sender); snd_seq_port_subscribe_set_dest(subs, dest); From 24a6748a02f87ac0ace270e23d6ed4506875d8de Mon Sep 17 00:00:00 2001 From: derselbst Date: Wed, 25 Oct 2017 16:58:20 +0200 Subject: [PATCH 07/12] use FLUID_LOG rather than fprintf --- src/drivers/fluid_alsa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/drivers/fluid_alsa.c b/src/drivers/fluid_alsa.c index 53dcb533..9fb324d6 100644 --- a/src/drivers/fluid_alsa.c +++ b/src/drivers/fluid_alsa.c @@ -179,14 +179,14 @@ static void fluid_alsa_autoconnect_inputs(fluid_alsa_seq_driver_t* dev, const sn snd_seq_port_subscribe_set_dest(subs, dest); if (snd_seq_get_port_subscription(seq, subs) == 0) { - fprintf(stderr, _("Connection %s is already subscribed\n"), pname); + FLUID_LOG(FLUID_ERR, "Connection %s is already subscribed\n", pname); continue; } if (snd_seq_subscribe_port(seq, subs) < 0) { - fprintf(stderr, _("Connection of %s failed (%s)\n"), pname, snd_strerror(errno)); + FLUID_LOG(FLUID_ERR, "Connection of %s failed (%s)\n", pname, snd_strerror(errno)); continue; } - fprintf(stderr, _("Connection of %s succeeded\n"), pname); + FLUID_LOG(FLUID_ERR, "Connection of %s succeeded\n", pname); } } } From 7c523979be29f493a6b99eb9133eae349c83b104 Mon Sep 17 00:00:00 2001 From: derselbst Date: Wed, 25 Oct 2017 17:10:56 +0200 Subject: [PATCH 08/12] document audio.alsa.autoconnect --- doc/fluidsettings.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/fluidsettings.xml b/doc/fluidsettings.xml index 35b05b18..94bb2261 100644 --- a/doc/fluidsettings.xml +++ b/doc/fluidsettings.xml @@ -239,6 +239,14 @@ https://stackoverflow.com/a/6251757 The format of the audio samples. This is currently only an indication; the audio driver may ignore this setting if it can't handle the specified format. + + alsa.autoconnect + bool + 0 (FALSE) + + If 1 (TRUE), automatically connects FluidSynth to available ALSA MIDI input ports. + + alsa.device str From 43d4659451f39982d5ae19e17215b92c9d2f231b Mon Sep 17 00:00:00 2001 From: derselbst Date: Wed, 25 Oct 2017 17:11:41 +0200 Subject: [PATCH 09/12] make vars const correct --- src/drivers/fluid_alsa.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/drivers/fluid_alsa.c b/src/drivers/fluid_alsa.c index 9fb324d6..2d0f39ed 100644 --- a/src/drivers/fluid_alsa.c +++ b/src/drivers/fluid_alsa.c @@ -166,10 +166,11 @@ static void fluid_alsa_autoconnect_inputs(fluid_alsa_seq_driver_t* dev, const sn snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo)); snd_seq_port_info_set_port(pinfo, -1); while (snd_seq_query_next_port(seq, pinfo) >= 0) { - unsigned int needed_type = SND_SEQ_PORT_TYPE_MIDI_GENERIC; - unsigned int needed_cap = SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ; + const unsigned int needed_type = SND_SEQ_PORT_TYPE_MIDI_GENERIC; + const unsigned int needed_cap = SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ; const snd_seq_addr_t *sender = snd_seq_port_info_get_addr(pinfo); const char *pname = snd_seq_port_info_get_name(pinfo); + if ((snd_seq_port_info_get_type(pinfo) & needed_type) != needed_type) continue; if ((snd_seq_port_info_get_capability(pinfo) & needed_cap) != needed_cap) From 48eb3943e27f5d49705c70349babba1b8a6dc0d2 Mon Sep 17 00:00:00 2001 From: derselbst Date: Thu, 26 Oct 2017 10:39:52 +0200 Subject: [PATCH 10/12] adjust log levels for alsa autoconnect --- src/drivers/fluid_alsa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/fluid_alsa.c b/src/drivers/fluid_alsa.c index 2d0f39ed..695c7d34 100644 --- a/src/drivers/fluid_alsa.c +++ b/src/drivers/fluid_alsa.c @@ -180,14 +180,14 @@ static void fluid_alsa_autoconnect_inputs(fluid_alsa_seq_driver_t* dev, const sn snd_seq_port_subscribe_set_dest(subs, dest); if (snd_seq_get_port_subscription(seq, subs) == 0) { - FLUID_LOG(FLUID_ERR, "Connection %s is already subscribed\n", pname); + FLUID_LOG(FLUID_WARN, "Connection %s is already subscribed\n", pname); continue; } if (snd_seq_subscribe_port(seq, subs) < 0) { FLUID_LOG(FLUID_ERR, "Connection of %s failed (%s)\n", pname, snd_strerror(errno)); continue; } - FLUID_LOG(FLUID_ERR, "Connection of %s succeeded\n", pname); + FLUID_LOG(FLUID_INFO, "Connection of %s succeeded\n", pname); } } } From 7872f808275c5a8303ad9e6a53604555dbc6829a Mon Sep 17 00:00:00 2001 From: derselbst Date: Thu, 26 Oct 2017 15:51:34 +0200 Subject: [PATCH 11/12] rename alsa autoconnect function to be alsa_seq specific --- src/drivers/fluid_alsa.c | 91 ++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/src/drivers/fluid_alsa.c b/src/drivers/fluid_alsa.c index 695c7d34..34f14c5e 100644 --- a/src/drivers/fluid_alsa.c +++ b/src/drivers/fluid_alsa.c @@ -147,51 +147,6 @@ static void fluid_alsa_seq_run(void* d); * */ -// Connect ALSA MIDI inputs to port_info -static void fluid_alsa_autoconnect_inputs(fluid_alsa_seq_driver_t* dev, const snd_seq_port_info_t *port_info) -{ - snd_seq_t *seq = dev->seq_handle; - snd_seq_port_subscribe_t *subs; - snd_seq_client_info_t *cinfo; - snd_seq_port_info_t *pinfo; - - snd_seq_port_subscribe_alloca(&subs); - snd_seq_client_info_alloca(&cinfo); - snd_seq_port_info_alloca(&pinfo); - - snd_seq_client_info_set_client(cinfo, -1); - while (snd_seq_query_next_client(seq, cinfo) >= 0) { - const snd_seq_addr_t *dest = snd_seq_port_info_get_addr(port_info); - - snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo)); - snd_seq_port_info_set_port(pinfo, -1); - while (snd_seq_query_next_port(seq, pinfo) >= 0) { - const unsigned int needed_type = SND_SEQ_PORT_TYPE_MIDI_GENERIC; - const unsigned int needed_cap = SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ; - const snd_seq_addr_t *sender = snd_seq_port_info_get_addr(pinfo); - const char *pname = snd_seq_port_info_get_name(pinfo); - - if ((snd_seq_port_info_get_type(pinfo) & needed_type) != needed_type) - continue; - if ((snd_seq_port_info_get_capability(pinfo) & needed_cap) != needed_cap) - continue; - - snd_seq_port_subscribe_set_sender(subs, sender); - snd_seq_port_subscribe_set_dest(subs, dest); - - if (snd_seq_get_port_subscription(seq, subs) == 0) { - FLUID_LOG(FLUID_WARN, "Connection %s is already subscribed\n", pname); - continue; - } - if (snd_seq_subscribe_port(seq, subs) < 0) { - FLUID_LOG(FLUID_ERR, "Connection of %s failed (%s)\n", pname, snd_strerror(errno)); - continue; - } - FLUID_LOG(FLUID_INFO, "Connection of %s succeeded\n", pname); - } - } -} - void fluid_alsa_audio_driver_settings(fluid_settings_t* settings) { fluid_settings_register_str(settings, "audio.alsa.device", "default", 0, NULL, NULL); @@ -797,6 +752,50 @@ static char* fluid_alsa_seq_full_name(char* id, int port, char* buf, int len) return buf; } +// Connect available ALSA MIDI inputs to port_info +static void fluid_alsa_seq_autoconnect(fluid_alsa_seq_driver_t* dev, const snd_seq_port_info_t *port_info) +{ + snd_seq_t *seq = dev->seq_handle; + snd_seq_port_subscribe_t *subs; + snd_seq_client_info_t *cinfo; + snd_seq_port_info_t *pinfo; + + snd_seq_port_subscribe_alloca(&subs); + snd_seq_client_info_alloca(&cinfo); + snd_seq_port_info_alloca(&pinfo); + + snd_seq_client_info_set_client(cinfo, -1); + while (snd_seq_query_next_client(seq, cinfo) >= 0) { + const snd_seq_addr_t *dest = snd_seq_port_info_get_addr(port_info); + + snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo)); + snd_seq_port_info_set_port(pinfo, -1); + while (snd_seq_query_next_port(seq, pinfo) >= 0) { + const unsigned int needed_type = SND_SEQ_PORT_TYPE_MIDI_GENERIC; + const unsigned int needed_cap = SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ; + const snd_seq_addr_t *sender = snd_seq_port_info_get_addr(pinfo); + const char *pname = snd_seq_port_info_get_name(pinfo); + + if ((snd_seq_port_info_get_type(pinfo) & needed_type) != needed_type) + continue; + if ((snd_seq_port_info_get_capability(pinfo) & needed_cap) != needed_cap) + continue; + + snd_seq_port_subscribe_set_sender(subs, sender); + snd_seq_port_subscribe_set_dest(subs, dest); + + if (snd_seq_get_port_subscription(seq, subs) == 0) { + FLUID_LOG(FLUID_WARN, "Connection %s is already subscribed\n", pname); + continue; + } + if (snd_seq_subscribe_port(seq, subs) < 0) { + FLUID_LOG(FLUID_ERR, "Connection of %s failed (%s)\n", pname, snd_strerror(errno)); + continue; + } + FLUID_LOG(FLUID_INFO, "Connection of %s succeeded\n", pname); + } + } +} /* * new_fluid_alsa_seq_driver @@ -938,7 +937,7 @@ new_fluid_alsa_seq_driver(fluid_settings_t* settings, fluid_settings_getint(settings, "audio.alsa.autoconnect", &autoconn_inputs); if (autoconn_inputs) - fluid_alsa_autoconnect_inputs(dev, port_info); + fluid_alsa_seq_autoconnect(dev, port_info); /* tell the lash server our client id */ #ifdef LASH_ENABLED From 56969332b25e718d601ad733a2d81b8a8c7af3a7 Mon Sep 17 00:00:00 2001 From: derselbst Date: Thu, 26 Oct 2017 15:56:27 +0200 Subject: [PATCH 12/12] promote audio.alsa.autoconnect to a more general setting that could be used across different midi drivers --- doc/fluidsettings.xml | 16 ++++++++-------- src/drivers/fluid_alsa.c | 3 +-- src/drivers/fluid_mdriver.c | 2 ++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/doc/fluidsettings.xml b/doc/fluidsettings.xml index 94bb2261..dcdd2a35 100644 --- a/doc/fluidsettings.xml +++ b/doc/fluidsettings.xml @@ -239,14 +239,6 @@ https://stackoverflow.com/a/6251757 The format of the audio samples. This is currently only an indication; the audio driver may ignore this setting if it can't handle the specified format. - - alsa.autoconnect - bool - 0 (FALSE) - - If 1 (TRUE), automatically connects FluidSynth to available ALSA MIDI input ports. - - alsa.device str @@ -412,6 +404,14 @@ https://stackoverflow.com/a/6251757 MIDI driver settings + autoconnect + bool + 0 (FALSE) + + If 1 (TRUE), automatically connects FluidSynth to available MIDI input ports. alsa_seq is currently the only driver making use of this. + + + driver str alsa_seq (Linux),
diff --git a/src/drivers/fluid_alsa.c b/src/drivers/fluid_alsa.c index 34f14c5e..4a959f7d 100644 --- a/src/drivers/fluid_alsa.c +++ b/src/drivers/fluid_alsa.c @@ -150,7 +150,6 @@ static void fluid_alsa_seq_run(void* d); void fluid_alsa_audio_driver_settings(fluid_settings_t* settings) { fluid_settings_register_str(settings, "audio.alsa.device", "default", 0, NULL, NULL); - fluid_settings_register_int(settings, "audio.alsa.autoconnect", 0, 0, 1, FLUID_HINT_TOGGLED, NULL, NULL); } @@ -935,7 +934,7 @@ new_fluid_alsa_seq_driver(fluid_settings_t* settings, } } - fluid_settings_getint(settings, "audio.alsa.autoconnect", &autoconn_inputs); + fluid_settings_getint(settings, "midi.autoconnect", &autoconn_inputs); if (autoconn_inputs) fluid_alsa_seq_autoconnect(dev, port_info); diff --git a/src/drivers/fluid_mdriver.c b/src/drivers/fluid_mdriver.c index ee459dc1..8d8cf382 100644 --- a/src/drivers/fluid_mdriver.c +++ b/src/drivers/fluid_mdriver.c @@ -144,6 +144,8 @@ void fluid_midi_driver_settings(fluid_settings_t* settings) { unsigned int i; + fluid_settings_register_int (settings, "midi.autoconnect", 0, 0, 1, FLUID_HINT_TOGGLED, NULL, NULL); + fluid_settings_register_int (settings, "midi.realtime-prio", FLUID_DEFAULT_MIDI_RT_PRIO, 0, 99, 0, NULL, NULL);