summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-02-23 12:32:24 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2016-02-23 12:32:24 -0500
commit735a3e9b77396d1a685b41e310416148c52cadda (patch)
tree4e79c4f95d94203137d2e92b4e58d2334dbc5a7a
parent1ff912463e5553c515ea45a411d136e775e32613 (diff)
downloadjack1-735a3e9b77396d1a685b41e310416148c52cadda.tar.gz
alsa_midi: stop using duplicated client name as part of port name for ALSA MIDI bridge ports
-rw-r--r--drivers/alsa_midi/port.c45
1 files changed, 33 insertions, 12 deletions
diff --git a/drivers/alsa_midi/port.c b/drivers/alsa_midi/port.c
index ee88273..6f1cb04 100644
--- a/drivers/alsa_midi/port.c
+++ b/drivers/alsa_midi/port.c
@@ -103,22 +103,43 @@ a2j_port_fill_name (struct a2j_port * port_ptr, int dir, snd_seq_client_info_t *
const snd_seq_port_info_t * port_info_ptr, bool make_unique)
{
char *c;
+ const char* const client_name = snd_seq_client_info_get_name (client_info_ptr);
+ const char* const port_name = snd_seq_port_info_get_name (port_info_ptr);
if (make_unique) {
- snprintf (port_ptr->name,
- sizeof(port_ptr->name),
- "%s [%d] %s %s",
- snd_seq_client_info_get_name (client_info_ptr),
- snd_seq_client_info_get_client (client_info_ptr),
- snd_seq_port_info_get_name (port_info_ptr),
+ if (strstr (port_name, client_name) == port_name) {
+ /* entire client name is part of the port name so don't replicate it */
+ snprintf (port_ptr->name,
+ sizeof(port_ptr->name),
+ "[%d] %s %s",
+ snd_seq_client_info_get_client (client_info_ptr),
+ port_name,
(dir == A2J_PORT_CAPTURE ? "in" : "out"));
+ } else {
+ snprintf (port_ptr->name,
+ sizeof(port_ptr->name),
+ "%s [%d] %s %s",
+ client_name,
+ snd_seq_client_info_get_client (client_info_ptr),
+ port_name,
+ (dir == A2J_PORT_CAPTURE ? "in" : "out"));
+ }
} else {
- snprintf (port_ptr->name,
- sizeof(port_ptr->name),
- "%s %s %s",
- snd_seq_client_info_get_name (client_info_ptr),
- snd_seq_port_info_get_name (port_info_ptr),
- (dir == A2J_PORT_CAPTURE ? "in" : "out"));
+ if (strstr (port_name, client_name) == port_name) {
+ /* entire client name is part of the port name so don't replicate it */
+ snprintf (port_ptr->name,
+ sizeof(port_ptr->name),
+ "%s %s",
+ port_name,
+ (dir == A2J_PORT_CAPTURE ? "in" : "out"));
+ } else {
+ snprintf (port_ptr->name,
+ sizeof(port_ptr->name),
+ "%s %s %s",
+ client_name,
+ snd_seq_port_info_get_name (port_info_ptr),
+ (dir == A2J_PORT_CAPTURE ? "in" : "out"));
+ }
}
// replace all offending characters with ' '