diff --git a/linux/alsa/alsa_rawmidi.c b/linux/alsa/alsa_rawmidi.c index 0f6b137c..31658116 100644 --- a/linux/alsa/alsa_rawmidi.c +++ b/linux/alsa/alsa_rawmidi.c @@ -441,6 +441,7 @@ inline int midi_port_open_jack(alsa_rawmidi_t *midi, midi_port_t *port, int type type | JackPortIsPhysical | JackPortIsTerminal, 0); // Like in alsa_seqmidi.c, use the Jack1 port name as alias. -ag + const char *prefix = "alsa_midi:"; const char* device_name = port->device_name; const char* port_name = port->subdev_name; const char *type_name = (type & JackPortIsOutput) ? "out" : "in"; @@ -448,13 +449,15 @@ inline int midi_port_open_jack(alsa_rawmidi_t *midi, midi_port_t *port, int type /* entire client name is part of the port name so don't replicate it */ snprintf (name, sizeof(name), - "alsa_midi:%s (%s)", + "%s%s (%s)", + prefix, port_name, type_name); } else { snprintf (name, sizeof(name), - "alsa_midi:%s %s (%s)", + "%s%s %s (%s)", + prefix, device_name, port_name, type_name); @@ -472,7 +475,8 @@ inline int midi_port_open_jack(alsa_rawmidi_t *midi, midi_port_t *port, int type // we just ignore the given alias argument, and use the Jack1 // port name from above instead -ag jack_port_set_alias(port->jack, name); - jack_port_set_default_metadata(port->jack, port->device_name); + // Pretty-name metadata is the same as alias without the prefix. + jack_port_set_default_metadata (port->jack, name+strlen(prefix)); } return port->jack == NULL; diff --git a/linux/alsa/alsa_seqmidi.c b/linux/alsa/alsa_seqmidi.c index 8a6b77d8..c890c1bb 100644 --- a/linux/alsa/alsa_seqmidi.c +++ b/linux/alsa/alsa_seqmidi.c @@ -512,6 +512,7 @@ port_t* port_create(alsa_seqmidi_t *self, int type, snd_seq_addr_t addr, const s goto failed; // First alias: Jack1-compatible port name. -ag + const char *prefix = "alsa_midi:"; const char *device_name = snd_seq_client_info_get_name(client_info); const char* port_name = snd_seq_port_info_get_name (info); const char* type_name = jack_caps & JackPortIsOutput ? "out" : "in"; @@ -520,13 +521,15 @@ port_t* port_create(alsa_seqmidi_t *self, int type, snd_seq_addr_t addr, const s /* entire client name is part of the port name so don't replicate it */ snprintf (port->name, sizeof(port->name), - "alsa_midi:%s (%s)", + "%s%s (%s)", + prefix, port_name, type_name); } else { snprintf (port->name, sizeof(port->name), - "alsa_midi:%s %s (%s)", + "%s%s %s (%s)", + prefix, device_name, port_name, type_name); @@ -540,7 +543,8 @@ port_t* port_create(alsa_seqmidi_t *self, int type, snd_seq_addr_t addr, const s } jack_port_set_alias (port->jack_port, port->name); - jack_port_set_default_metadata (port->jack_port, device_name); + // Pretty-name metadata is the same as first alias without the prefix. + jack_port_set_default_metadata (port->jack_port, port->name+strlen(prefix)); // Second alias: Strip the alsa_midi prefix, so that devices appear // under their ALSA names. Use the ALSA port names (without device @@ -562,7 +566,6 @@ port_t* port_create(alsa_seqmidi_t *self, int type, snd_seq_addr_t addr, const s } jack_port_set_alias (port->jack_port, port->name); - jack_port_set_default_metadata (port->jack_port, device_name); if (type == PORT_INPUT) err = alsa_connect_from(self, port->remote.client, port->remote.port);