Merge jackaudio/develop into LADI/main

This commit is contained in:
Nedko Arnaudov 2023-08-29 21:40:09 +03:00
commit 59a8aad4e1
2 changed files with 55 additions and 26 deletions

View File

@ -147,13 +147,13 @@ static port_type_t port_type[2] = {
{ {
SND_SEQ_PORT_CAP_SUBS_READ, SND_SEQ_PORT_CAP_SUBS_READ,
JackPortIsOutput, JackPortIsOutput,
"playback", "capture",
do_jack_input do_jack_input
}, },
{ {
SND_SEQ_PORT_CAP_SUBS_WRITE, SND_SEQ_PORT_CAP_SUBS_WRITE,
JackPortIsInput, JackPortIsInput,
"capture", "playback",
do_jack_output do_jack_output
} }
}; };
@ -493,17 +493,6 @@ port_t* port_create(alsa_seqmidi_t *self, int type, snd_seq_addr_t addr, const s
snd_seq_client_info_alloca (&client_info); snd_seq_client_info_alloca (&client_info);
snd_seq_get_any_client_info (self->seq, addr.client, client_info); snd_seq_get_any_client_info (self->seq, addr.client, client_info);
const char *device_name = snd_seq_client_info_get_name(client_info);
// This used the alsa_pcm prefix, but that doesn't make any
// sense. Jack1 uses alsa_midi, so we do the same. -ag
snprintf(port->name, sizeof(port->name), "alsa_midi:%s/midi_%s_%d",
device_name, port_type[type].name, addr.port+1);
// replace all offending characters by -
for (c = port->name; *c; ++c)
if (!isalnum(*c) && *c != '/' && *c != '_' && *c != ':' && *c != '(' && *c != ')')
*c = '-';
jack_caps = port_type[type].jack_caps; jack_caps = port_type[type].jack_caps;
/* mark anything that looks like a hardware port as physical&terminal */ /* mark anything that looks like a hardware port as physical&terminal */
@ -522,21 +511,61 @@ port_t* port_create(alsa_seqmidi_t *self, int type, snd_seq_addr_t addr, const s
if (!port->jack_port) if (!port->jack_port)
goto failed; goto failed;
jack_port_set_alias (port->jack_port, port->name); // First alias: Jack1-compatible port name. -ag
jack_port_set_default_metadata (port->jack_port, device_name); 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";
// This code is pilfered from Jack1. -ag
if (strstr (port_name, device_name) == port_name) {
/* entire client name is part of the port name so don't replicate it */
snprintf (port->name,
sizeof(port->name),
"%s%s (%s)",
prefix,
port_name,
type_name);
} else {
snprintf (port->name,
sizeof(port->name),
"%s%s %s (%s)",
prefix,
device_name,
port_name,
type_name);
}
/* generate an alias */ // replace all offending characters with ' '
for (c = port->name; *c; ++c) {
snprintf(port->name, sizeof(port->name), "%s:midi/%s_%d", if (!isalnum(*c) && *c != ' ' && *c != '/' && *c != '_' && *c != ':' && *c != '(' && *c != ')') {
snd_seq_client_info_get_name (client_info), port_type[type].name, addr.port+1); *c = ' ';
}
// replace all offending characters by - }
for (c = port->name; *c; ++c)
if (!isalnum(*c) && *c != '/' && *c != '_' && *c != ':' && *c != '(' && *c != ')') jack_port_set_alias (port->jack_port, port->name);
*c = '-'; // 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
// prefix) for the individual ports. -ag
if (strstr (port_name, device_name) == port_name) {
// remove the device name prefix from the port name if present
port_name += strlen(device_name);
while (*port_name == ' ' || *port_name == '\t')
port_name++;
}
snprintf(port->name, sizeof(port->name), "%s:%s (%s)",
device_name, port_name, port_type[type].name);
// replace all offending characters with ' '
for (c = port->name; *c; ++c) {
if (!isalnum(*c) && *c != ' ' && *c != '/' && *c != '_' && *c != ':' && *c != '(' && *c != ')') {
*c = ' ';
}
}
jack_port_set_alias (port->jack_port, port->name); jack_port_set_alias (port->jack_port, port->name);
jack_port_set_default_metadata (port->jack_port, device_name);
if (type == PORT_INPUT) if (type == PORT_INPUT)
err = alsa_connect_from(self, port->remote.client, port->remote.port); err = alsa_connect_from(self, port->remote.client, port->remote.port);

View File

@ -13,7 +13,7 @@
</choices-outline> </choices-outline>
<domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true" /> <domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true" />
<license file="@CURDIR@/../COPYING" mime-type="text/plain" /> <license file="@CURDIR@/../COPYING" mime-type="text/plain" />
<options customize="never" hostArchitectures="x86_64" require-scripts="false" rootVolumeOnly="true" /> <options customize="never" hostArchitectures="arm64,x86_64" require-scripts="false" rootVolumeOnly="true" />
<pkg-ref id="org.jackaudio.jack2" /> <pkg-ref id="org.jackaudio.jack2" />
<welcome file="@CURDIR@/package-welcome.txt" mime-type="text/plain" /> <welcome file="@CURDIR@/package-welcome.txt" mime-type="text/plain" />
</installer-gui-script> </installer-gui-script>