Ports say when they're going away.
git-svn-id: svn://localhost/ardour2/branches/3.0@4380 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
d5427db306
commit
9935b950ee
@ -26,6 +26,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <sigc++/signal.h>
|
#include <sigc++/signal.h>
|
||||||
#include <pbd/failed_constructor.h>
|
#include <pbd/failed_constructor.h>
|
||||||
|
#include <pbd/destructible.h>
|
||||||
#include <ardour/ardour.h>
|
#include <ardour/ardour.h>
|
||||||
#include <ardour/data_type.h>
|
#include <ardour/data_type.h>
|
||||||
#include <jack/jack.h>
|
#include <jack/jack.h>
|
||||||
@ -37,7 +38,7 @@ class Buffer;
|
|||||||
|
|
||||||
/** Abstract base for ports
|
/** Abstract base for ports
|
||||||
*/
|
*/
|
||||||
class Port : public virtual sigc::trackable {
|
class Port : public virtual PBD::Destructible {
|
||||||
public:
|
public:
|
||||||
enum Flags {
|
enum Flags {
|
||||||
IsInput = JackPortIsInput,
|
IsInput = JackPortIsInput,
|
||||||
@ -132,6 +133,10 @@ class Port : public virtual sigc::trackable {
|
|||||||
std::set<Port*> _connections;
|
std::set<Port*> _connections;
|
||||||
|
|
||||||
static AudioEngine* engine;
|
static AudioEngine* engine;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void port_going_away (Port *);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PortConnectableByName {
|
class PortConnectableByName {
|
||||||
|
@ -34,6 +34,7 @@ Port::Port (const std::string& name, Flags flgs)
|
|||||||
|
|
||||||
Port::~Port ()
|
Port::~Port ()
|
||||||
{
|
{
|
||||||
|
drop_references ();
|
||||||
disconnect_all ();
|
disconnect_all ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ Port::connect (Port& other)
|
|||||||
result = _connections.insert (&other);
|
result = _connections.insert (&other);
|
||||||
|
|
||||||
if (result.second) {
|
if (result.second) {
|
||||||
|
other.GoingAway.connect (sigc::bind (mem_fun (*this, &Port::port_going_away), &other));
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
@ -131,6 +133,14 @@ Port::get_connections (vector<string>& names) const
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Port::port_going_away (Port* p)
|
||||||
|
{
|
||||||
|
/* caller must hold process lock */
|
||||||
|
|
||||||
|
disconnect (*p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
||||||
@ -377,3 +387,4 @@ PortFacade::reset ()
|
|||||||
_ext_port->reset ();
|
_ext_port->reset ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user