Fix connections when re-starting engine
The connection was stored by the Port where it was initiated from: 1. Connect A to B 2. Disconnect B from A (1) Port A remembers the connection to B (2) Port B does not know about the connection from A Since disconnect is initiated on port B, port A still retained the connection information. When restarting the engine, Port::reconnect() reestablished the connection. This is only relevant when libardour's own connection information is used. e.g. the session is closed without engine, or when re-starting the engine while the session is open.
This commit is contained in:
parent
a393f75694
commit
786388b5b6
|
@ -196,6 +196,7 @@ Port::disconnect_all ()
|
|||
for (vector<string>::const_iterator c = connections.begin(); c != connections.end() && pself; ++c) {
|
||||
boost::shared_ptr<Port> pother = AudioEngine::instance()->get_port_by_name (*c);
|
||||
if (pother) {
|
||||
pother->_connections.erase (_name);
|
||||
ConnectedOrDisconnected (pself, pother, false); // emit signal
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +258,22 @@ Port::connect (std::string const & other)
|
|||
}
|
||||
|
||||
if (r == 0) {
|
||||
/* Connections can be saved on either or both sides. The code above works regardless
|
||||
* from which end the conneciton is initiated, and connecting already connected ports
|
||||
* is idempotent.
|
||||
*
|
||||
* Only saving internal connection on the source-side would be preferable,
|
||||
* but this is not what JACK does :(
|
||||
* Port::get_state() calls Port::get_connections() which in case of JACK is symmetric.
|
||||
*
|
||||
* This is also nicer when reading the session file's <Port><Connection>.
|
||||
*/
|
||||
_connections.insert (other);
|
||||
|
||||
boost::shared_ptr<Port> pother = AudioEngine::instance()->get_port_by_name (other);
|
||||
if (pother) {
|
||||
pother->_connections.insert (_name);
|
||||
}
|
||||
}
|
||||
|
||||
return r;
|
||||
|
@ -285,6 +301,10 @@ Port::disconnect (std::string const & other)
|
|||
boost::shared_ptr<Port> pself = AudioEngine::instance()->get_port_by_name (name());
|
||||
boost::shared_ptr<Port> pother = AudioEngine::instance()->get_port_by_name (other);
|
||||
|
||||
if (r == 0 && pother) {
|
||||
pother->_connections.erase (_name);
|
||||
}
|
||||
|
||||
if (pself && pother) {
|
||||
/* Disconnecting from another Ardour port: need to allow
|
||||
a check on whether this may affect anything that we
|
||||
|
|
Loading…
Reference in New Issue
Block a user