Make the port matrix notice if JACK ports are registered or unregistered.
authorCarl Hetherington <carl@carlh.net>
Sun, 11 Oct 2009 22:16:20 +0000 (22:16 +0000)
committerCarl Hetherington <carl@carlh.net>
Sun, 11 Oct 2009 22:16:20 +0000 (22:16 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@5765 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/port_matrix.cc
libs/ardour/ardour/audioengine.h
libs/ardour/audioengine.cc

index d9eea649e91973ab4e81ccfa201410490f423d0d..febd6ab56584085c2ebe16787c7492489b969ed2 100644 (file)
@@ -29,6 +29,7 @@
 #include "ardour/types.h"
 #include "ardour/session.h"
 #include "ardour/route.h"
+#include "ardour/audioengine.h"
 #include "port_matrix.h"
 #include "port_matrix_body.h"
 #include "port_matrix_component.h"
@@ -73,6 +74,9 @@ PortMatrix::PortMatrix (Window* parent, Session& session, DataType type)
 
        /* and also bundles */
        _session.BundleAdded.connect (sigc::hide (mem_fun (*this, &PortMatrix::setup_global_ports)));
+
+       /* and also ports */
+       _session.engine().PortRegisteredOrUnregistered.connect (mem_fun (*this, &PortMatrix::setup_all_ports));
        
        reconnect_to_routes ();
 
index cb8baf85dfa597ecc6f24aded7cbcfc63fbd4396..f0bd7cdb3d23f46084a1dd3116f4a0e318d4cf9f 100644 (file)
@@ -203,6 +203,10 @@ class AudioEngine : public sigc::trackable
        sigc::signal<void> Running;
        sigc::signal<void> Stopped;
 
+       /* this signal is emitted if a JACK port is registered or unregistered */
+       
+       sigc::signal<void> PortRegisteredOrUnregistered;
+
        std::string make_port_name_relative (std::string);
        std::string make_port_name_non_relative (std::string);
 
@@ -250,6 +254,7 @@ class AudioEngine : public sigc::trackable
        static void _jack_timebase_callback (jack_transport_state_t, nframes_t, jack_position_t*, int, void*);
        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 *);
 
        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*);
index 17d5318f48bae1e8be8a4385ba5a3eb1a5a14819..56f78482ee9d30283b03d202ec049106be396083 100644 (file)
@@ -179,6 +179,7 @@ AudioEngine::start ()
                jack_set_xrun_callback (_jack, _xrun_callback, this);
                jack_set_sync_callback (_jack, _jack_sync_callback, this);
                jack_set_freewheel_callback (_jack, _freewheel_callback, this);
+               jack_set_port_registration_callback (_jack, _registration_callback, this);
 
                if (session && session->config.get_jack_time_master()) {
                        jack_set_timebase_callback (_jack, 0, _jack_timebase_callback, this);
@@ -309,6 +310,13 @@ AudioEngine::_freewheel_callback (int onoff, void *arg)
        static_cast<AudioEngine*>(arg)->_freewheeling = onoff;
 }
 
+void
+AudioEngine::_registration_callback (jack_port_id_t /*id*/, int /*reg*/, void* arg)
+{
+       AudioEngine* ae = static_cast<AudioEngine*> (arg);
+       ae->PortRegisteredOrUnregistered (); /* EMIT SIGNAL */
+}
+
 void
 AudioEngine::split_cycle (nframes_t offset)
 {