From 0b5d6696796e13cc5b49664528894541f00fa240 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 4 Mar 2025 15:51:39 +0100 Subject: [PATCH] jack: add option and disable MIDI2 port flags by default Add an option to add the MIDI2 flag on ports. This is disabled by default because most JACK apps don't know about the flag and then refuse to show the MIDI ports. Fixes #4584 --- doc/dox/config/pipewire-jack.conf.5.md | 10 +++++++++- pipewire-jack/src/pipewire-jack.c | 4 +++- src/daemon/jack.conf.in | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/dox/config/pipewire-jack.conf.5.md b/doc/dox/config/pipewire-jack.conf.5.md index a2e2f6e31..b8a4a5cf0 100644 --- a/doc/dox/config/pipewire-jack.conf.5.md +++ b/doc/dox/config/pipewire-jack.conf.5.md @@ -70,7 +70,7 @@ jack.properties = { #jack.max-client-ports = 768 #jack.fill-aliases = false #jack.writable-input = false - + #jack.flag-midi2 = false } ``` @@ -198,6 +198,14 @@ from the buffer. Set this to true to avoid buffer corruption if you are only dealing with non-buggy clients. \endparblock +@PAR@ jack.conf jack.flag-midi2 +\parblock +Use the new JACK MIDI2 port flag on MIDI2 (UMP) ports. This is disabled by default because most +JACK apps don't know about this flag yet and refuse to show the port. + +Set this to true for applications that know how to handle MIDI2 ports. +\endparblock + # MATCH RULES @IDX@ jack.conf `jack.rules` provides an `update-props` action that takes an object with properties that are updated diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c index 54dd41975..839a9fc24 100644 --- a/pipewire-jack/src/pipewire-jack.c +++ b/pipewire-jack/src/pipewire-jack.c @@ -472,6 +472,7 @@ struct client { unsigned int fill_aliases:1; unsigned int writable_input:1; unsigned int async:1; + unsigned int flag_midi2:1; uint32_t max_frames; uint32_t max_align; @@ -3818,7 +3819,7 @@ static void registry_event_global(void *data, uint32_t id, if ((str = spa_dict_lookup(props, PW_KEY_PORT_NAME)) == NULL) goto exit; - if (type_id == TYPE_ID_UMP) + if (type_id == TYPE_ID_UMP && c->flag_midi2) flags |= JackPortIsMIDI2; spa_dict_for_each(item, props) { @@ -4400,6 +4401,7 @@ jack_client_t * jack_client_open (const char *client_name, client->fill_aliases = pw_properties_get_bool(client->props, "jack.fill-aliases", false); client->writable_input = pw_properties_get_bool(client->props, "jack.writable-input", true); client->async = pw_properties_get_bool(client->props, PW_KEY_NODE_ASYNC, false); + client->flag_midi2 = pw_properties_get_bool(client->props, "jack.flag-midi2", false); client->self_connect_mode = SELF_CONNECT_ALLOW; if ((str = pw_properties_get(client->props, "jack.self-connect-mode")) != NULL) { diff --git a/src/daemon/jack.conf.in b/src/daemon/jack.conf.in index b3be1c681..32d8076d7 100644 --- a/src/daemon/jack.conf.in +++ b/src/daemon/jack.conf.in @@ -95,6 +95,7 @@ jack.properties = { #jack.max-client-ports = 768 #jack.fill-aliases = false #jack.writable-input = true + #jack.flag-midi2 = false } # client specific properties