/*
- Copyright (C) 2009 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2009-2011 David Robillard <d@drobilla.net>
+ * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2010-2016 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2013-2014 Robin Gareus <robin@gareus.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
#include <gtkmm/image.h>
#include <gtkmm/stock.h>
+
#include "global_port_matrix.h"
#include "utils.h"
#include "ardour/audioengine.h"
#include "ardour/port.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace std;
using namespace ARDOUR;
+using namespace ARDOUR_UI_UTILS;
GlobalPortMatrix::GlobalPortMatrix (Gtk::Window* p, Session* s, DataType t)
: PortMatrix (p, s, t)
} else {
/* two non-Ardour ports */
if (s) {
- jack_connect (_session->engine().jack (), j->c_str(), i->c_str());
+ AudioEngine::instance()->connect (*j, *i);
} else {
- jack_disconnect (_session->engine().jack (), j->c_str(), i->c_str());
+ AudioEngine::instance()->disconnect (*j, *i);
}
}
}
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) {
- boost::shared_ptr<Port> p = _session->engine().get_port_by_name (*i);
- boost::shared_ptr<Port> q = _session->engine().get_port_by_name (*j);
+ boost::shared_ptr<Port> p = AudioEngine::instance()->get_port_by_name (*i);
+ boost::shared_ptr<Port> q = AudioEngine::instance()->get_port_by_name (*j);
if (!p && !q) {
/* two non-Ardour ports; things are slightly more involved */
- /* XXX: is this the easiest way to do this? */
- /* XXX: isn't this very inefficient? */
- jack_client_t* jack = _session->engine().jack ();
- jack_port_t* jp = jack_port_by_name (jack, i->c_str());
- if (jp == 0) {
+ /* get a port handle for one of them .. */
+
+ PortEngine::PortHandle ph = AudioEngine::instance()->port_engine().get_port_by_name (*i);
+ if (!ph) {
return PortMatrixNode::NOT_ASSOCIATED;
}
- char const ** c = jack_port_get_all_connections (jack, jp);
-
- char const ** p = c;
+ /* see if it is connected to the other one ... */
- while (p && *p != 0) {
- if (strcmp (*p, j->c_str()) == 0) {
- free (c);
- return PortMatrixNode::ASSOCIATED;
- }
- ++p;
+ if (AudioEngine::instance()->port_engine().connected_to (ph, *j, false)) {
+ return PortMatrixNode::ASSOCIATED;
}
- free (c);
return PortMatrixNode::NOT_ASSOCIATED;
}