using namespace ARDOUR;
using namespace PBD;
+PBD::Signal2<void,boost::shared_ptr<Port>, boost::shared_ptr<Port> > Port::PostDisconnect;
+
AudioEngine* Port::_engine = 0;
bool Port::_connecting_blocked = false;
pframes_t Port::_global_port_buffer_offset = 0;
jack_port_disconnect (_engine->jack(), _jack_port);
_connections.clear ();
+ /* a cheaper, less hacky way to do boost::shared_from_this() ...
+ */
+ boost::shared_ptr<Port> pself = _engine->get_port_by_name (name());
+ PostDisconnect (pself, boost::shared_ptr<Port>()); // emit signal
+
return 0;
}
int
Port::disconnect (std::string const & other)
{
- std::string const other_shrt = _engine->make_port_name_non_relative (other);
- std::string const this_shrt = _engine->make_port_name_non_relative (_name);
+ std::string const other_fullname = _engine->make_port_name_non_relative (other);
+ std::string const this_fullname = _engine->make_port_name_non_relative (_name);
int r = 0;
if (sends_output ()) {
- r = jack_disconnect (_engine->jack (), this_shrt.c_str (), other_shrt.c_str ());
+ r = jack_disconnect (_engine->jack (), this_fullname.c_str (), other_fullname.c_str ());
} else {
- r = jack_disconnect (_engine->jack (), other_shrt.c_str (), this_shrt.c_str ());
+ r = jack_disconnect (_engine->jack (), other_fullname.c_str (), this_fullname.c_str ());
}
if (r == 0) {
_connections.erase (other);
}
+ /* a cheaper, less hacky way to do boost::shared_from_this() ...
+ */
+ boost::shared_ptr<Port> pself = _engine->get_port_by_name (name());
+ boost::shared_ptr<Port> pother = _engine->get_port_by_name (other);
+
+ if (pself && pother) {
+ /* Disconnecting from another Ardour port: need to allow
+ a check on whether this may affect anything that we
+ need to know about.
+ */
+ PostDisconnect (pself, pother); // emit signal
+ }
+
return r;
}