summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-12-29 17:52:32 +0000
committerCarl Hetherington <carl@carlh.net>2010-12-29 17:52:32 +0000
commit0dd2fb557c95f15672345e6368a478d25898a4d1 (patch)
tree8022453f0d85b0719018f9f1d85523fa59669035 /libs/ardour
parentf31e5b5d714752484f3e5ea2a1228fdef0527154 (diff)
Update mixer strip input/output button labels from the general JACK port connection / disconnection callback so that all changes are noticed. Fixes #3638.
git-svn-id: svn://localhost/ardour2/branches/3.0@8368 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/audioengine.h7
-rw-r--r--libs/ardour/ardour/io.h2
-rw-r--r--libs/ardour/audioengine.cc24
-rw-r--r--libs/ardour/io.cc9
4 files changed, 37 insertions, 5 deletions
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index a4eb68b1bb..390c0bbda6 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -245,8 +245,11 @@ _ the regular process() call to session->process() is not made.
/** Emitted if a JACK port is registered or unregistered */
PBD::Signal0<void> PortRegisteredOrUnregistered;
- /** Emitted if a JACK port is connected or disconnected */
- PBD::Signal0<void> PortConnectedOrDisconnected;
+ /** Emitted if a JACK port is connected or disconnected.
+ * The Port parameters are the ports being connected / disconnected, or 0 if they are not known to Ardour.
+ * The bool parameter is true if ports were connected, or false for disconnected.
+ */
+ PBD::Signal3<void, Port *, Port *, bool> PortConnectedOrDisconnected;
std::string make_port_name_relative (std::string);
std::string make_port_name_non_relative (std::string);
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h
index 94dbfadb04..8335225f3c 100644
--- a/libs/ardour/ardour/io.h
+++ b/libs/ardour/ardour/io.h
@@ -118,6 +118,8 @@ class IO : public SessionObject, public Latent
PortSet& ports() { return _ports; }
const PortSet& ports() const { return _ports; }
+ bool has_port (Port *) const;
+
Port *nth (uint32_t n) const {
if (n < _ports.num_ports()) {
return _ports.port(n);
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 683dbca422..b2241f5c2f 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -394,10 +394,30 @@ AudioEngine::_registration_callback (jack_port_id_t /*id*/, int /*reg*/, void* a
}
void
-AudioEngine::_connect_callback (jack_port_id_t /*id_a*/, jack_port_id_t /*id_b*/, int /*conn*/, void* arg)
+AudioEngine::_connect_callback (jack_port_id_t id_a, jack_port_id_t id_b, int conn, void* arg)
{
AudioEngine* ae = static_cast<AudioEngine*> (arg);
- ae->PortConnectedOrDisconnected (); /* EMIT SIGNAL */
+
+ GET_PRIVATE_JACK_POINTER (ae->_jack);
+
+ jack_port_t* jack_port_a = jack_port_by_id (_priv_jack, id_a);
+ jack_port_t* jack_port_b = jack_port_by_id (_priv_jack, id_b);
+
+ Port* port_a = 0;
+ Port* port_b = 0;
+
+ boost::shared_ptr<Ports> pr = ae->ports.reader ();
+ Ports::iterator i = pr->begin ();
+ while (i != pr->end() && (port_a == 0 || port_b == 0)) {
+ if (jack_port_a == (*i)->_jack_port) {
+ port_a = *i;
+ } else if (jack_port_b == (*i)->_jack_port) {
+ port_b = *i;
+ }
+ ++i;
+ }
+
+ ae->PortConnectedOrDisconnected (port_a, port_b, conn == 0 ? false : true); /* EMIT SIGNAL */
}
void
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index ced4508d7a..17a1da231b 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -162,7 +162,7 @@ IO::disconnect (Port* our_port, string other_port, void* src)
if (other_port.length() == 0 || our_port == 0) {
return 0;
}
-
+
{
Glib::Mutex::Lock lm (io_lock);
@@ -1612,3 +1612,10 @@ IO::physically_connected () const
return false;
}
+
+bool
+IO::has_port (Port* p) const
+{
+ Glib::Mutex::Lock lm (io_lock);
+ return _ports.contains (p);
+}