Make audio.jack.autoconnect connect all available ports (#923)

This commit is contained in:
Tom M 2021-06-27 11:45:52 +02:00 committed by GitHub
parent 95e3693779
commit 92089e0a0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -614,14 +614,14 @@ new_fluid_jack_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func
{ {
jack_ports = jack_get_ports(client, NULL, NULL, JackPortIsInput | JackPortIsPhysical); jack_ports = jack_get_ports(client, NULL, NULL, JackPortIsInput | JackPortIsPhysical);
if(jack_ports) if(jack_ports && jack_ports[0])
{ {
int err; int err, o = 0;
int connected = 0; int connected = 0;
for(i = 0; jack_ports[i] && i < 2 * dev->num_output_ports; ++i) for(i = 0; i < 2 * dev->num_output_ports; ++i)
{ {
err = jack_connect(client, jack_port_name(dev->output_ports[i]), jack_ports[i]); err = jack_connect(client, jack_port_name(dev->output_ports[i]), jack_ports[o++]);
if(err) if(err)
{ {
@ -631,11 +631,17 @@ new_fluid_jack_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func
{ {
connected++; connected++;
} }
if(!jack_ports[o])
{
o = 0;
}
} }
o = 0;
for(i = 0; jack_ports[i] && i < 2 * dev->num_fx_ports; ++i) for(i = 0; jack_ports[i] && i < 2 * dev->num_fx_ports; ++i)
{ {
err = jack_connect(client, jack_port_name(dev->fx_ports[i]), jack_ports[i]); err = jack_connect(client, jack_port_name(dev->fx_ports[i]), jack_ports[o++]);
if(err) if(err)
{ {
@ -645,6 +651,11 @@ new_fluid_jack_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func
{ {
connected++; connected++;
} }
if(!jack_ports[o])
{
o = 0;
}
} }
jack_free(jack_ports); /* free jack ports array (not the port values!) */ jack_free(jack_ports); /* free jack ports array (not the port values!) */