2008-06-02 17:41:35 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2009 Paul Davis
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2009-07-12 20:26:28 -04:00
|
|
|
#ifdef WAF_BUILD
|
|
|
|
#include "libardour-config.h"
|
|
|
|
#endif
|
|
|
|
|
2011-02-15 13:47:10 -05:00
|
|
|
#include <jack/weakjack.h> // so that we can test for new functions at runtime
|
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
#include "ardour/port.h"
|
|
|
|
#include "ardour/audioengine.h"
|
|
|
|
#include "pbd/failed_constructor.h"
|
|
|
|
#include "pbd/error.h"
|
|
|
|
#include "pbd/compose.h"
|
|
|
|
#include <stdexcept>
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-02-25 16:48:32 -05:00
|
|
|
#include "i18n.h"
|
|
|
|
|
2009-01-30 02:40:13 -05:00
|
|
|
using namespace std;
|
|
|
|
using namespace ARDOUR;
|
|
|
|
|
|
|
|
AudioEngine* Port::_engine = 0;
|
2010-12-03 17:26:29 -05:00
|
|
|
pframes_t Port::_buffer_size = 0;
|
2010-06-02 12:21:02 -04:00
|
|
|
bool Port::_connecting_blocked = false;
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-01-21 22:13:34 -05:00
|
|
|
/** @param n Port short name */
|
2009-02-10 19:58:24 -05:00
|
|
|
Port::Port (std::string const & n, DataType t, Flags f)
|
|
|
|
: _last_monitor (false)
|
2009-01-30 02:40:13 -05:00
|
|
|
, _name (n)
|
|
|
|
, _flags (f)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-01-30 02:40:13 -05:00
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
/* Unfortunately we have to pass the DataType into this constructor so that we can
|
|
|
|
create the right kind of JACK port; aside from this we'll use the virtual function type ()
|
2009-10-14 12:10:01 -04:00
|
|
|
to establish type.
|
2009-01-30 02:40:13 -05:00
|
|
|
*/
|
2009-01-21 22:13:34 -05:00
|
|
|
|
|
|
|
assert (_name.find_first_of (':') == std::string::npos);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-10-27 17:18:18 -04:00
|
|
|
if (!_engine->connected()) {
|
|
|
|
throw failed_constructor ();
|
|
|
|
}
|
|
|
|
|
2009-02-10 19:58:24 -05:00
|
|
|
if ((_jack_port = jack_port_register (_engine->jack (), _name.c_str (), t.to_jack_type (), _flags, 0)) == 0) {
|
2010-11-20 17:29:01 -05:00
|
|
|
cerr << "Failed to register JACK port, reason is unknown from here\n";
|
2009-02-10 19:58:24 -05:00
|
|
|
throw failed_constructor ();
|
2009-01-20 21:27:21 -05:00
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
/** Port destructor */
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::~Port ()
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2010-11-13 17:50:03 -05:00
|
|
|
if (_engine->jack ()) {
|
|
|
|
jack_port_unregister (_engine->jack (), _jack_port);
|
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
/** @return true if this port is connected to anything */
|
|
|
|
bool
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::connected () const
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-01-30 02:40:13 -05:00
|
|
|
return (jack_port_connected (_jack_port) != 0);
|
|
|
|
}
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
int
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::disconnect_all ()
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-01-20 21:27:21 -05:00
|
|
|
jack_port_disconnect (_engine->jack(), _jack_port);
|
2009-02-10 19:58:24 -05:00
|
|
|
_connections.clear ();
|
2009-01-30 02:40:13 -05:00
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
return 0;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
/** @param o Port name
|
|
|
|
* @return true if this port is connected to o, otherwise false.
|
|
|
|
*/
|
2008-06-02 17:41:35 -04:00
|
|
|
bool
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::connected_to (std::string const & o) const
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2011-01-19 13:58:50 -05:00
|
|
|
if (!_engine->connected()) {
|
|
|
|
/* in some senses, this answer isn't the right one all the time,
|
|
|
|
because we know about our connections and will re-establish
|
|
|
|
them when we reconnect to JACK.
|
|
|
|
*/
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-02-10 19:58:24 -05:00
|
|
|
return jack_port_connected_to (_jack_port, _engine->make_port_name_non_relative(o).c_str ());
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2009-01-21 22:13:34 -05:00
|
|
|
/** @param o Filled in with port full names of ports that we are connected to */
|
2008-06-02 17:41:35 -04:00
|
|
|
int
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::get_connections (std::vector<std::string> & c) const
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-01-20 21:27:21 -05:00
|
|
|
int n = 0;
|
|
|
|
|
2011-01-19 13:58:50 -05:00
|
|
|
if (_engine->connected()) {
|
|
|
|
const char** jc = jack_port_get_connections (_jack_port);
|
|
|
|
if (jc) {
|
|
|
|
for (int i = 0; jc[i]; ++i) {
|
|
|
|
c.push_back (jc[i]);
|
|
|
|
++n;
|
|
|
|
}
|
|
|
|
|
|
|
|
jack_free (jc);
|
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
return n;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
int
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::connect (std::string const & other)
|
2009-01-02 14:38:43 -05:00
|
|
|
{
|
2009-01-21 22:13:34 -05:00
|
|
|
std::string const other_shrt = _engine->make_port_name_non_relative (other);
|
2009-02-10 19:58:24 -05:00
|
|
|
std::string const this_shrt = _engine->make_port_name_non_relative (_name);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-02-10 19:58:24 -05:00
|
|
|
int r = 0;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-06-21 19:45:15 -04:00
|
|
|
if (_connecting_blocked) {
|
2010-06-02 12:21:02 -04:00
|
|
|
return r;
|
2010-06-21 19:45:15 -04:00
|
|
|
}
|
2010-06-02 12:21:02 -04:00
|
|
|
|
2009-02-10 19:58:24 -05:00
|
|
|
if (sends_output ()) {
|
|
|
|
r = jack_connect (_engine->jack (), this_shrt.c_str (), other_shrt.c_str ());
|
|
|
|
} else {
|
|
|
|
r = jack_connect (_engine->jack (), other_shrt.c_str (), this_shrt.c_str());
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-02-10 19:58:24 -05:00
|
|
|
if (r == 0) {
|
|
|
|
_connections.insert (other);
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
2009-01-30 02:40:13 -05:00
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
return r;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
int
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::disconnect (std::string const & other)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-01-21 22:13:34 -05:00
|
|
|
std::string const other_shrt = _engine->make_port_name_non_relative (other);
|
2009-02-10 19:58:24 -05:00
|
|
|
std::string const this_shrt = _engine->make_port_name_non_relative (_name);
|
2009-01-20 21:27:21 -05:00
|
|
|
|
2009-02-10 19:58:24 -05:00
|
|
|
int r = 0;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-02-10 19:58:24 -05:00
|
|
|
if (sends_output ()) {
|
|
|
|
r = jack_disconnect (_engine->jack (), this_shrt.c_str (), other_shrt.c_str ());
|
2008-06-02 17:41:35 -04:00
|
|
|
} else {
|
2009-02-10 19:58:24 -05:00
|
|
|
r = jack_disconnect (_engine->jack (), other_shrt.c_str (), this_shrt.c_str ());
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-02-10 19:58:24 -05:00
|
|
|
if (r == 0) {
|
|
|
|
_connections.erase (other);
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-05-01 11:09:19 -04:00
|
|
|
return r;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
bool
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::connected_to (Port* o) const
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-01-20 21:27:21 -05:00
|
|
|
return connected_to (o->name ());
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::connect (Port* o)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-02-10 19:58:24 -05:00
|
|
|
return connect (o->name ());
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
int
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::disconnect (Port* o)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-02-10 19:58:24 -05:00
|
|
|
return disconnect (o->name ());
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
void
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::set_engine (AudioEngine* e)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-01-20 21:27:21 -05:00
|
|
|
_engine = e;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
void
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::ensure_monitor_input (bool yn)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-02-10 19:58:24 -05:00
|
|
|
jack_port_ensure_monitor (_jack_port, yn);
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::monitoring_input () const
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-02-10 19:58:24 -05:00
|
|
|
return jack_port_monitoring_input (_jack_port);
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::reset ()
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-01-20 21:27:21 -05:00
|
|
|
_last_monitor = false;
|
|
|
|
|
|
|
|
// XXX
|
|
|
|
// _metering = 0;
|
|
|
|
// reset_meters ();
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::recompute_total_latency () const
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2011-02-15 14:55:14 -05:00
|
|
|
#ifndef HAVE_JACK_NEW_LATENCY
|
|
|
|
#ifdef HAVE_JACK_RECOMPUTE_LATENCY
|
2009-11-27 19:53:54 -05:00
|
|
|
jack_client_t* jack = _engine->jack();
|
|
|
|
|
|
|
|
if (!jack) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
jack_recompute_total_latency (jack, _jack_port);
|
2009-10-14 12:10:01 -04:00
|
|
|
#endif
|
2011-02-15 13:47:10 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Port::set_latency_range (jack_latency_range_t& range, jack_latency_callback_mode_t mode) const
|
|
|
|
{
|
2011-02-15 14:55:14 -05:00
|
|
|
#ifdef HAVE_JACK_NEW_LATENCY
|
2011-02-15 13:47:10 -05:00
|
|
|
if (!jack_port_set_latency_range) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
jack_port_set_latency_range (_jack_port, mode, &range);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Port::get_connected_latency_range (jack_latency_range_t& range, jack_latency_callback_mode_t mode) const
|
|
|
|
{
|
2011-02-15 14:55:14 -05:00
|
|
|
#ifdef HAVE_JACK_NEW_LATENCY
|
2011-02-15 13:47:10 -05:00
|
|
|
if (!jack_port_get_latency_range) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
vector<string> connections;
|
|
|
|
jack_client_t* jack = _engine->jack();
|
|
|
|
|
|
|
|
if (!jack) {
|
|
|
|
range.min = 0;
|
|
|
|
range.max = 0;
|
|
|
|
PBD::warning << _("get_connected_latency_range() called while disconnected from JACK") << endmsg;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
get_connections (connections);
|
|
|
|
|
|
|
|
if (!connections.empty()) {
|
|
|
|
|
|
|
|
range.min = ~((jack_nframes_t) 0);
|
|
|
|
range.max = 0;
|
|
|
|
|
|
|
|
for (vector<string>::iterator c = connections.begin(); c != connections.end(); ++c) {
|
|
|
|
jack_port_t* remote_port = jack_port_by_name (_engine->jack(), (*c).c_str());
|
|
|
|
jack_latency_range_t lr;
|
|
|
|
|
|
|
|
if (remote_port) {
|
|
|
|
jack_port_get_latency_range (remote_port, mode, &lr);
|
|
|
|
range.min = min (range.min, lr.min);
|
|
|
|
range.min = max (range.max, lr.max);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
range.min = 0;
|
|
|
|
range.max = 0;
|
|
|
|
}
|
|
|
|
#endif /* HAVE_JACK_NEW_LATENCY */
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2010-12-03 17:26:29 -05:00
|
|
|
framecnt_t
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::total_latency () const
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2011-02-15 14:55:14 -05:00
|
|
|
#ifndef HAVE_JACK_NEW_LATENCY
|
2009-11-27 19:53:54 -05:00
|
|
|
jack_client_t* jack = _engine->jack();
|
|
|
|
|
|
|
|
if (!jack) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return jack_port_get_total_latency (jack, _jack_port);
|
2011-02-15 13:47:10 -05:00
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::reestablish ()
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-11-27 19:53:54 -05:00
|
|
|
jack_client_t* jack = _engine->jack();
|
|
|
|
|
|
|
|
if (!jack) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 02:30:50 -04:00
|
|
|
cerr << "RE-REGISTER: " << _name.c_str() << endl;
|
2009-11-27 19:53:54 -05:00
|
|
|
_jack_port = jack_port_register (jack, _name.c_str(), type().to_jack_type(), _flags, 0);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
if (_jack_port == 0) {
|
|
|
|
PBD::error << string_compose (_("could not reregister %1"), _name) << endmsg;
|
|
|
|
return -1;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
reset ();
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
return 0;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::reconnect ()
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-01-20 21:27:21 -05:00
|
|
|
/* caller must hold process lock; intended to be used only after reestablish() */
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-02-10 19:58:24 -05:00
|
|
|
for (std::set<string>::iterator i = _connections.begin(); i != _connections.end(); ++i) {
|
2009-01-20 21:27:21 -05:00
|
|
|
if (connect (*i)) {
|
|
|
|
return -1;
|
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
return 0;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2009-06-25 16:46:39 -04:00
|
|
|
/** @param n Short port name (no JACK client name) */
|
2008-06-02 17:41:35 -04:00
|
|
|
int
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::set_name (std::string const & n)
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-06-23 16:02:15 -04:00
|
|
|
if (n == _name) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-06-25 16:46:39 -04:00
|
|
|
int const r = jack_port_set_name (_jack_port, n.c_str());
|
2009-01-21 22:13:34 -05:00
|
|
|
|
2009-02-10 19:58:24 -05:00
|
|
|
if (r == 0) {
|
2009-10-14 12:10:01 -04:00
|
|
|
_name = n;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
return r;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2009-01-20 21:27:21 -05:00
|
|
|
void
|
2009-01-30 02:40:13 -05:00
|
|
|
Port::request_monitor_input (bool yn)
|
2009-01-20 21:27:21 -05:00
|
|
|
{
|
2009-02-10 19:58:24 -05:00
|
|
|
jack_port_request_monitor (_jack_port, yn);
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
2009-01-30 02:40:13 -05:00
|
|
|
|
|
|
|
void
|
2010-12-03 17:26:29 -05:00
|
|
|
Port::set_latency (framecnt_t n)
|
2009-01-30 02:40:13 -05:00
|
|
|
{
|
2011-02-15 14:55:14 -05:00
|
|
|
#ifndef HAVE_JACK_NEW_LATENCY
|
2009-02-10 19:58:24 -05:00
|
|
|
jack_port_set_latency (_jack_port, n);
|
2011-02-15 13:47:10 -05:00
|
|
|
#endif
|
2009-01-30 02:40:13 -05:00
|
|
|
}
|
2009-04-23 13:48:37 -04:00
|
|
|
|
2010-05-01 11:09:19 -04:00
|
|
|
bool
|
|
|
|
Port::physically_connected () const
|
|
|
|
{
|
|
|
|
const char** jc = jack_port_get_connections (_jack_port);
|
|
|
|
|
|
|
|
if (jc) {
|
|
|
|
for (int i = 0; jc[i]; ++i) {
|
|
|
|
|
|
|
|
jack_port_t* port = jack_port_by_name (_engine->jack(), jc[i]);
|
|
|
|
|
|
|
|
if (port && (jack_port_flags (port) & JackPortIsPhysical)) {
|
|
|
|
jack_free (jc);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
jack_free (jc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2010-06-09 09:00:54 -04:00
|
|
|
|