13
0

Work around connection loss when re-starting JACK backend

If connecting ports using the port-engine fails,
ardour forgets the connection.

Internal backends only produced an error if a port was already
connected, when using ::connect (handle, other), but
ignore already existing connection when using port-names.

Various ports are connected twice when the engine connects
at session load. This worked fine for as long as the engine
was never stopped (saving the session asks the port-engine),
but failed when the engine went away and internal representation
is used.
This commit is contained in:
Robin Gareus 2021-11-01 23:01:27 +01:00
parent 6b348d8183
commit 79330f909e
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 9 additions and 2 deletions

View File

@ -81,7 +81,7 @@ BackendPort::connect (BackendPortHandle port, BackendPortHandle self)
<< " (" << name () << ") -> (" << port->name () << ")"
<< endmsg;
#endif
return -1;
return 0;
}
store_connection (port);

View File

@ -617,7 +617,11 @@ int
JACKAudioBackend::connect (PortHandle port, const std::string& other)
{
GET_PRIVATE_JACK_POINTER_RET (_priv_jack, -1);
return jack_connect (_priv_jack, jack_port_name (boost::dynamic_pointer_cast<JackPort>(port)->jack_ptr), other.c_str());
int r = jack_connect (_priv_jack, jack_port_name (boost::dynamic_pointer_cast<JackPort>(port)->jack_ptr), other.c_str());
if (r == 0 || r == EEXIST) {
return 0;
}
return r;
}
int
JACKAudioBackend::connect (const std::string& src, const std::string& dst)
@ -625,6 +629,9 @@ JACKAudioBackend::connect (const std::string& src, const std::string& dst)
GET_PRIVATE_JACK_POINTER_RET (_priv_jack, -1);
int r = jack_connect (_priv_jack, src.c_str(), dst.c_str());
if (r == 0 || r == EEXIST) {
return 0;
}
return r;
}