summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/port_matrix.cc23
-rw-r--r--gtk2_ardour/port_matrix.h1
-rw-r--r--libs/ardour/ardour/audioengine.h7
-rw-r--r--libs/ardour/audioengine.cc8
4 files changed, 31 insertions, 8 deletions
diff --git a/gtk2_ardour/port_matrix.cc b/gtk2_ardour/port_matrix.cc
index f26a78a722..88987f03ef 100644
--- a/gtk2_ardour/port_matrix.cc
+++ b/gtk2_ardour/port_matrix.cc
@@ -121,7 +121,7 @@ PortMatrix::init ()
{
select_arrangement ();
- /* Signal handling is kind of split into two parts:
+ /* Signal handling is kind of split into three parts:
*
* 1. When _ports[] changes, we call setup(). This essentially sorts out our visual
* representation of the information in _ports[].
@@ -129,6 +129,8 @@ PortMatrix::init ()
* 2. When certain other things change, we need to get our subclass to clear and
* re-fill _ports[], which in turn causes appropriate signals to be raised to
* hook into part (1).
+ *
+ * 3. Assorted other signals.
*/
@@ -142,11 +144,6 @@ PortMatrix::init ()
_ports[i].BundleChanged.connect (_bundle_changed_connections, invalidator (*this), boost::bind (&PortMatrix::setup, this), gui_context());
}
- /* scrolling stuff */
- _hscroll.signal_value_changed().connect (sigc::mem_fun (*this, &PortMatrix::hscroll_changed));
- _vscroll.signal_value_changed().connect (sigc::mem_fun (*this, &PortMatrix::vscroll_changed));
-
-
/* Part 2: notice when things have changed that require our subclass to clear and refill _ports[] */
/* watch for routes being added or removed */
@@ -158,6 +155,14 @@ PortMatrix::init ()
/* and also ports */
_session->engine().PortRegisteredOrUnregistered.connect (_session_connections, invalidator (*this), boost::bind (&PortMatrix::setup_global_ports, this), gui_context());
+
+ /* Part 3: other stuff */
+
+ _session->engine().PortConnectedOrDisconnected.connect (_session_connections, invalidator (*this), boost::bind (&PortMatrix::port_connected_or_disconnected, this), gui_context ());
+
+ _hscroll.signal_value_changed().connect (sigc::mem_fun (*this, &PortMatrix::hscroll_changed));
+ _vscroll.signal_value_changed().connect (sigc::mem_fun (*this, &PortMatrix::vscroll_changed));
+
reconnect_to_routes ();
setup ();
@@ -829,3 +834,9 @@ PortMatrix::add_disassociate_option (Menu_Helpers::MenuList& m, boost::weak_ptr<
snprintf (buf, sizeof (buf), _("%s all from '%s'"), disassociation_verb().c_str(), escape_underscores (b->channel_name (c)).c_str());
m.push_back (MenuElem (buf, sigc::bind (sigc::mem_fun (*this, &PortMatrix::disassociate_all_on_channel), w, c, d)));
}
+
+void
+PortMatrix::port_connected_or_disconnected ()
+{
+ _body->rebuild_and_draw_grid ();
+}
diff --git a/gtk2_ardour/port_matrix.h b/gtk2_ardour/port_matrix.h
index a33d8c2910..0c0a52a1a1 100644
--- a/gtk2_ardour/port_matrix.h
+++ b/gtk2_ardour/port_matrix.h
@@ -189,6 +189,7 @@ private:
void session_going_away ();
void add_remove_option (Gtk::Menu_Helpers::MenuList &, boost::weak_ptr<ARDOUR::Bundle>, int);
void add_disassociate_option (Gtk::Menu_Helpers::MenuList &, boost::weak_ptr<ARDOUR::Bundle>, int, int);
+ void port_connected_or_disconnected ();
Gtk::Window* _parent;
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index ac521fbd4c..e630e1a95e 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -230,10 +230,12 @@ _ the regular process() call to session->process() is not made.
PBD::Signal0<void> Running;
PBD::Signal0<void> Stopped;
- /* this signal is emitted if a JACK port is registered or unregistered */
-
+ /** 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;
+
std::string make_port_name_relative (std::string);
std::string make_port_name_non_relative (std::string);
@@ -288,6 +290,7 @@ _ the regular process() call to session->process() is not made.
static int _jack_sync_callback (jack_transport_state_t, jack_position_t*, void *arg);
static void _freewheel_callback (int , void *arg);
static void _registration_callback (jack_port_id_t, int, void *);
+ static void _connect_callback (jack_port_id_t, jack_port_id_t, int, void *);
void jack_timebase_callback (jack_transport_state_t, nframes_t, jack_position_t*, int);
int jack_sync_callback (jack_transport_state_t, jack_position_t*);
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 6ffe0f6048..db1c4f2ef5 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -195,6 +195,7 @@ AudioEngine::start ()
jack_set_sync_callback (_priv_jack, _jack_sync_callback, this);
jack_set_freewheel_callback (_priv_jack, _freewheel_callback, this);
jack_set_port_registration_callback (_priv_jack, _registration_callback, this);
+ jack_set_port_connect_callback (_priv_jack, _connect_callback, this);
if (_session && _session->config.get_jack_time_master()) {
jack_set_timebase_callback (_priv_jack, 0, _jack_timebase_callback, this);
@@ -349,6 +350,13 @@ 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* ae = static_cast<AudioEngine*> (arg);
+ ae->PortConnectedOrDisconnected (); /* EMIT SIGNAL */
+}
+
+void
AudioEngine::split_cycle (nframes_t offset)
{
/* caller must hold process lock */