mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-18 04:36:30 +01:00
notify IO about port disconnection due to port removal
[Jack] Ports can be deleted without being disconnected first. the IO Object does not catch that condition.
This commit is contained in:
parent
10bffda810
commit
81faa3b420
2 changed files with 29 additions and 4 deletions
|
|
@ -169,8 +169,10 @@ private:
|
||||||
*/
|
*/
|
||||||
std::set<std::string> _connections;
|
std::set<std::string> _connections;
|
||||||
|
|
||||||
void drop ();
|
void port_connected_or_disconnected (boost::weak_ptr<Port>, boost::weak_ptr<Port>, bool);
|
||||||
PBD::ScopedConnection drop_connection;
|
void drop ();
|
||||||
|
PBD::ScopedConnection drop_connection;
|
||||||
|
PBD::ScopedConnection engine_connection;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,8 @@ Port::Port (std::string const & n, DataType t, PortFlags f)
|
||||||
}
|
}
|
||||||
|
|
||||||
PortDrop.connect_same_thread (drop_connection, boost::bind (&Port::drop, this));
|
PortDrop.connect_same_thread (drop_connection, boost::bind (&Port::drop, this));
|
||||||
|
port_manager->PortConnectedOrDisconnected.connect_same_thread (engine_connection,
|
||||||
|
boost::bind (&Port::port_connected_or_disconnected, this, _1, _3, _5));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Port destructor */
|
/** Port destructor */
|
||||||
|
|
@ -126,6 +128,26 @@ Port::drop ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Port::port_connected_or_disconnected (boost::weak_ptr<Port> w0, boost::weak_ptr<Port> w1, bool con)
|
||||||
|
{
|
||||||
|
if (con) {
|
||||||
|
/* we're only interested in disconnect */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boost::shared_ptr<Port> p0 = w0.lock ();
|
||||||
|
boost::shared_ptr<Port> p1 = w1.lock ();
|
||||||
|
/* a cheaper, less hacky way to do boost::shared_from_this() ... */
|
||||||
|
boost::shared_ptr<Port> pself = AudioEngine::instance()->get_port_by_name (name());
|
||||||
|
|
||||||
|
if (p0 == pself) {
|
||||||
|
PostDisconnect (p0, p1); // emit signal
|
||||||
|
}
|
||||||
|
if (p1 == pself) {
|
||||||
|
PostDisconnect (p1, p0); // emit signal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** @return true if this port is connected to anything */
|
/** @return true if this port is connected to anything */
|
||||||
bool
|
bool
|
||||||
Port::connected () const
|
Port::connected () const
|
||||||
|
|
@ -238,8 +260,7 @@ Port::disconnect (std::string const & other)
|
||||||
_connections.erase (other);
|
_connections.erase (other);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* a cheaper, less hacky way to do boost::shared_from_this() ...
|
/* a cheaper, less hacky way to do boost::shared_from_this() ... */
|
||||||
*/
|
|
||||||
boost::shared_ptr<Port> pself = AudioEngine::instance()->get_port_by_name (name());
|
boost::shared_ptr<Port> pself = AudioEngine::instance()->get_port_by_name (name());
|
||||||
boost::shared_ptr<Port> pother = AudioEngine::instance()->get_port_by_name (other);
|
boost::shared_ptr<Port> pother = AudioEngine::instance()->get_port_by_name (other);
|
||||||
|
|
||||||
|
|
@ -478,6 +499,8 @@ Port::reestablish ()
|
||||||
|
|
||||||
reset ();
|
reset ();
|
||||||
|
|
||||||
|
port_manager->PortConnectedOrDisconnected.connect_same_thread (engine_connection,
|
||||||
|
boost::bind (&Port::port_connected_or_disconnected, this, _1, _3, _5));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue