Make port matrix notice when connections are changed outside of ardour.

git-svn-id: svn://localhost/ardour2/branches/3.0@6858 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-04-05 15:23:54 +00:00
parent 7c9c3b8f6c
commit 6e49c73bb0
4 changed files with 31 additions and 8 deletions

View File

@ -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 ();
}

View File

@ -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;

View File

@ -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*);

View File

@ -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);
@ -348,6 +349,13 @@ AudioEngine::_registration_callback (jack_port_id_t /*id*/, int /*reg*/, void* a
ae->PortRegisteredOrUnregistered (); /* EMIT SIGNAL */
}
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)
{