Don't redraw the summary every time the playhead moves (if it hasn't moved visibly...
[ardour.git] / gtk2_ardour / global_port_matrix.cc
index 0c5ae172642609594d0b1e25ad09e3e9e0194585..f4803f156ba201fe6f9c8c19f57de8dbb2158ed9 100644 (file)
@@ -53,13 +53,11 @@ GlobalPortMatrix::set_state (BundleChannel c[2], bool s)
        Bundle::PortList const & in_ports = c[IN].bundle->channel_ports (c[IN].channel);
        Bundle::PortList const & out_ports = c[OUT].bundle->channel_ports (c[OUT].channel);
 
-        Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock());
-
        for (Bundle::PortList::const_iterator i = in_ports.begin(); i != in_ports.end(); ++i) {
                for (Bundle::PortList::const_iterator j = out_ports.begin(); j != out_ports.end(); ++j) {
 
-                       Port* p = _session->engine().get_port_by_name_locked (*i);
-                       Port* q = _session->engine().get_port_by_name_locked (*j);
+                       boost::shared_ptr<Port> p = _session->engine().get_port_by_name (*i);
+                       boost::shared_ptr<Port> q = _session->engine().get_port_by_name (*j);
 
                        if (p) {
                                if (s) {
@@ -91,7 +89,11 @@ GlobalPortMatrix::get_state (BundleChannel c[2]) const
        if (_session == 0) {
                return PortMatrixNode::NOT_ASSOCIATED;
        }
-       
+
+       if (c[0].bundle->nchannels() == ChanCount::ZERO || c[1].bundle->nchannels() == ChanCount::ZERO) {
+               return PortMatrixNode::NOT_ASSOCIATED;
+       }
+
        Bundle::PortList const & in_ports = c[IN].bundle->channel_ports (c[IN].channel);
        Bundle::PortList const & out_ports = c[OUT].bundle->channel_ports (c[OUT].channel);
        if (in_ports.empty() || out_ports.empty()) {
@@ -103,8 +105,8 @@ GlobalPortMatrix::get_state (BundleChannel c[2]) const
        for (Bundle::PortList::const_iterator i = in_ports.begin(); i != in_ports.end(); ++i) {
                for (Bundle::PortList::const_iterator j = out_ports.begin(); j != out_ports.end(); ++j) {
 
-                       Port* p = _session->engine().get_port_by_name (*i);
-                       Port* q = _session->engine().get_port_by_name (*j);
+                       boost::shared_ptr<Port> p = _session->engine().get_port_by_name (*i);
+                       boost::shared_ptr<Port> q = _session->engine().get_port_by_name (*j);
 
                        if (!p && !q) {
                                /* two non-Ardour ports; things are slightly more involved */
@@ -116,11 +118,11 @@ GlobalPortMatrix::get_state (BundleChannel c[2]) const
                                if (jp == 0) {
                                        return PortMatrixNode::NOT_ASSOCIATED;
                                }
-                               
+
                                char const ** c = jack_port_get_all_connections (jack, jp);
 
                                char const ** p = c;
-                               
+
                                while (p && *p != 0) {
                                        if (strcmp (*p, j->c_str()) == 0) {
                                                free (c);
@@ -146,7 +148,8 @@ GlobalPortMatrix::get_state (BundleChannel c[2]) const
 }
 
 GlobalPortMatrixWindow::GlobalPortMatrixWindow (Session* s, DataType t)
-       : _port_matrix (this, s, t)
+       : ArdourWindow (X_("reset me soon"))
+       , _port_matrix (this, s, t)
 {
        switch (t) {
        case DataType::AUDIO:
@@ -186,4 +189,4 @@ GlobalPortMatrix::channel_noun () const
 {
        return _("port");
 }
-                
+