diff --git a/ChangeLog b/ChangeLog index 9bc6f6bef5..fa17bca17a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-11-25 Simon Budig + + * modules/controller_linux_input.c: Add some sample code to retrieve + the name of the connected MIDI device (ALSA). + Do not set the "name" when connected to Alsa, since snd_seq_name() + returns an uninteresting name. + 2004-11-24 Michael Natterer * app/gui/gui.c (gui_display_changed): if the active display diff --git a/modules/controller_midi.c b/modules/controller_midi.c index 1446ffd372..63be158c66 100644 --- a/modules/controller_midi.c +++ b/modules/controller_midi.c @@ -480,10 +480,7 @@ midi_set_device (ControllerMidi *midi, state = g_strdup_printf (_("Reading from %s"), alsa); g_free (alsa); - g_object_set (midi, - "name", snd_seq_name (midi->sequencer), - "state", state, - NULL); + g_object_set (midi, "state", state, NULL); g_free (state); event_source = (GAlsaSource *) g_source_new (&alsa_source_funcs, @@ -852,7 +849,9 @@ midi_alsa_dispatch (GSource *source, gpointer user_data) { ControllerMidi *midi = CONTROLLER_MIDI (((GAlsaSource *) source)->controller); - snd_seq_event_t *event; + snd_seq_event_t *event; + snd_seq_client_info_t *client_info; + snd_seq_port_info_t *port_info; if (snd_seq_event_input_pending (midi->sequencer, 1) > 0) { @@ -879,6 +878,28 @@ midi_alsa_dispatch (GSource *source, (gdouble) event->data.control.value / 127.0); break; + case SND_SEQ_EVENT_PORT_SUBSCRIBED: + snd_seq_client_info_alloca (&client_info); + snd_seq_port_info_alloca (&port_info); + snd_seq_get_any_client_info (midi->sequencer, + event->data.connect.sender.client, + client_info); + snd_seq_get_any_port_info (midi->sequencer, + event->data.connect.sender.client, + event->data.connect.sender.port, + port_info); + /* + * g_printerr ("subscribed to \"%s:%s\"\n", + * snd_seq_client_info_get_name (client_info), + * snd_seq_port_info_get_name (port_info)); + */ + break; + + case SND_SEQ_EVENT_PORT_UNSUBSCRIBED: + /* g_printerr ("unsubscribed\n"); + */ + break; + default: break; }