[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[fluid-dev] Patch for specifyng alsa sequencer port
From: |
Nicolas Boulicault |
Subject: |
[fluid-dev] Patch for specifyng alsa sequencer port |
Date: |
Sun, 01 Jun 2008 14:32:57 +0200 |
User-agent: |
Icedove 1.5.0.14pre (X11/20071018) |
Hi all,
I'm using scripts to connect FluidSynth to alsa midi ports to other
applications.
I added a "-p" option to specify the midi port name since it helps
writting this kind of scripts.
I didn't find this option looking for it in the doc, may be I was
mistaken / blind.
Anyway I generated this small patch..
Thanks for this nice app.
boul
diff -rup fluidsynth-1.0.8/src/fluid_alsa.c
fluidsynth-1.0.8.modified/src/fluid_alsa.c
--- fluidsynth-1.0.8/src/fluid_alsa.c 2007-09-19 08:02:37.000000000 +0200
+++ fluidsynth-1.0.8.modified/src/fluid_alsa.c 2008-06-01 14:13:19.000000000
+0200
@@ -897,8 +897,9 @@ new_fluid_alsa_seq_driver(fluid_settings
struct sched_param priority;
int count;
struct pollfd *pfd = NULL;
- char* device = NULL;
- char* id;
+ char * device = NULL;
+ char * id;
+ char * portname;
char full_id[64];
char full_name[64];
char id_pid[16];
@@ -934,6 +935,11 @@ new_fluid_alsa_seq_driver(fluid_settings
id = id_pid;
}
+ /* get the midi portname */
+ fluid_settings_getstr(settings, "midi.portname", &portname);
+ if (!strcmp(portname, ""))
+ portname = NULL;
+
/* open the sequencer INPUT only */
err = snd_seq_open(&dev->seq_handle, device, SND_SEQ_OPEN_INPUT, 0);
if (err < 0) {
@@ -962,7 +968,12 @@ new_fluid_alsa_seq_driver(fluid_settings
FLUID_FREE(pfd);
/* set the client name */
- snd_seq_set_client_name(dev->seq_handle, fluid_alsa_seq_full_id(id, full_id,
64));
+ if (!portname) {
+ snd_seq_set_client_name(dev->seq_handle, fluid_alsa_seq_full_id(id,
full_id, 64));
+ }
+ else {
+ snd_seq_set_client_name(dev->seq_handle, portname);
+ }
/* create the ports */
@@ -982,7 +993,12 @@ new_fluid_alsa_seq_driver(fluid_settings
for (i = 0; i < dev->port_count; i++) {
- snd_seq_port_info_set_name(port_info, fluid_alsa_seq_full_name(id, i,
full_name, 64));
+ if (!portname) {
+ snd_seq_port_info_set_name(port_info, fluid_alsa_seq_full_name(id, i,
full_name, 64));
+ }
+ else {
+ snd_seq_port_info_set_name(port_info, portname);
+ }
snd_seq_port_info_set_port(port_info, i);
err = snd_seq_create_port(dev->seq_handle, port_info);
diff -rup fluidsynth-1.0.8/src/fluid_synth.c
fluidsynth-1.0.8.modified/src/fluid_synth.c
--- fluidsynth-1.0.8/src/fluid_synth.c 2007-11-11 21:09:51.000000000 +0100
+++ fluidsynth-1.0.8.modified/src/fluid_synth.c 2008-06-01 13:46:22.000000000
+0200
@@ -112,6 +112,7 @@ void fluid_synth_settings(fluid_settings
fluid_settings_register_str(settings, "synth.reverb.active", "yes", 0, NULL,
NULL);
fluid_settings_register_str(settings, "synth.chorus.active", "yes", 0, NULL,
NULL);
fluid_settings_register_str(settings, "synth.ladspa.active", "no", 0, NULL,
NULL);
+ fluid_settings_register_str(settings, "midi.portname", "", 0, NULL, NULL);
fluid_settings_register_int(settings, "synth.polyphony",
256, 16, 4096, 0, NULL, NULL);
diff -rup fluidsynth-1.0.8/src/fluidsynth.c
fluidsynth-1.0.8.modified/src/fluidsynth.c
--- fluidsynth-1.0.8/src/fluidsynth.c 2007-11-11 11:09:48.000000000 +0100
+++ fluidsynth-1.0.8.modified/src/fluidsynth.c 2008-06-01 14:14:32.000000000
+0200
@@ -213,7 +213,7 @@ int main(int argc, char** argv)
int with_server = 0;
int dump = 0;
int connect_lash = 1;
- char *optchars = "a:C:c:df:G:g:hijK:L:lm:no:R:r:sVvz:";
+ char *optchars = "a:C:c:df:G:g:hijK:L:lm:no:p:R:r:sVvz:";
#ifdef LASH_ENABLED
int enabled_lash = 0; /* set to TRUE if lash gets enabled */
fluid_lash_args_t *lash_args;
@@ -247,6 +247,7 @@ int main(int argc, char** argv)
{"no-midi-in", 0, 0, 'n'},
{"no-shell", 0, 0, 'i'},
{"option", 1, 0, 'o'},
+ {"portname", 1, 0, 'p'},
{"reverb", 1, 0, 'R'},
{"sample-rate", 1, 0, 'r'},
{"server", 0, 0, 's'},
@@ -355,6 +356,9 @@ int main(int argc, char** argv)
case 'o':
process_o_cmd_line_option(settings, optarg);
break;
+ case 'p' :
+ fluid_settings_setstr(settings, "midi.portname", optarg);
+ break;
case 'R':
if ((optarg != NULL) && ((strcmp(optarg, "0") == 0) || (strcmp(optarg,
"no") == 0))) {
fluid_settings_setstr(settings, "synth.reverb.active", "no");
@@ -688,6 +692,8 @@ print_help()
" The name of the midi driver to use [oss,alsa,alsa_seq,...]\n");
printf(" -n, --no-midi-in\n"
" Don't create a midi driver to read MIDI input events [default =
yes]\n");
+ printf(" -p, --portname=[label]\n"
+ " Set alsa midi port name\n");
printf(" -o\n"
" Define a setting, -o name=value (\"-o help\" to dump current
values)\n");
printf(" -R, --reverb\n"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [fluid-dev] Patch for specifyng alsa sequencer port,
Nicolas Boulicault <=