Add & implement PortEngine::externally_connected() API
This commit is contained in:
parent
16b4535281
commit
94e2bce740
|
@ -228,6 +228,14 @@ class LIBARDOUR_API PortEngine {
|
||||||
*/
|
*/
|
||||||
virtual bool physically_connected (PortHandle port, bool process_callback_safe = true) = 0;
|
virtual bool physically_connected (PortHandle port, bool process_callback_safe = true) = 0;
|
||||||
|
|
||||||
|
/** Return true if the port referred to by @param port has any connections
|
||||||
|
* to external, not-ardour owned, ports.
|
||||||
|
*/
|
||||||
|
virtual bool externally_connected (PortHandle port, bool process_callback_safe = true) {
|
||||||
|
/* only with JACK, provides client ports that are not physical */
|
||||||
|
return physically_connected (port, process_callback_safe);
|
||||||
|
}
|
||||||
|
|
||||||
/** Place the names of all ports connected to the port named by @param
|
/** Place the names of all ports connected to the port named by @param
|
||||||
* ports into @param names, and return the number of connections.
|
* ports into @param names, and return the number of connections.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -145,6 +145,7 @@ class JACKAudioBackend : public AudioBackend {
|
||||||
bool connected (PortHandle, bool process_callback_safe);
|
bool connected (PortHandle, bool process_callback_safe);
|
||||||
bool connected_to (PortHandle, const std::string&, bool process_callback_safe);
|
bool connected_to (PortHandle, const std::string&, bool process_callback_safe);
|
||||||
bool physically_connected (PortHandle, bool process_callback_safe);
|
bool physically_connected (PortHandle, bool process_callback_safe);
|
||||||
|
bool externally_connected (PortHandle, bool process_callback_safe);
|
||||||
int get_connections (PortHandle, std::vector<std::string>&, bool process_callback_safe);
|
int get_connections (PortHandle, std::vector<std::string>&, bool process_callback_safe);
|
||||||
int connect (PortHandle, const std::string&);
|
int connect (PortHandle, const std::string&);
|
||||||
|
|
||||||
|
|
|
@ -275,6 +275,7 @@ JACKAudioBackend::physically_connected (PortHandle p, bool process_callback_safe
|
||||||
jack_port_t* other = jack_port_by_name (_priv_jack, ports[i]);
|
jack_port_t* other = jack_port_by_name (_priv_jack, ports[i]);
|
||||||
|
|
||||||
if (other && (jack_port_flags (other) & JackPortIsPhysical)) {
|
if (other && (jack_port_flags (other) & JackPortIsPhysical)) {
|
||||||
|
jack_free (ports);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,6 +285,39 @@ JACKAudioBackend::physically_connected (PortHandle p, bool process_callback_safe
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
JACKAudioBackend::externally_connected (PortHandle p, bool process_callback_safe)
|
||||||
|
{
|
||||||
|
GET_PRIVATE_JACK_POINTER_RET (_priv_jack, false);
|
||||||
|
jack_port_t* port = (jack_port_t*) p;
|
||||||
|
|
||||||
|
const char** ports;
|
||||||
|
|
||||||
|
if (process_callback_safe) {
|
||||||
|
ports = jack_port_get_connections ((jack_port_t*)port);
|
||||||
|
} else {
|
||||||
|
GET_PRIVATE_JACK_POINTER_RET (_priv_jack, false);
|
||||||
|
ports = jack_port_get_all_connections (_priv_jack, (jack_port_t*)port);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ports) {
|
||||||
|
for (int i = 0; ports[i]; ++i) {
|
||||||
|
jack_port_t* other = jack_port_by_name (_priv_jack, ports[i]);
|
||||||
|
|
||||||
|
if (other && (jack_port_flags (other) & JackPortIsPhysical)) {
|
||||||
|
jack_free (ports);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (other && !jack_port_is_mine (_priv_jack, other)) {
|
||||||
|
jack_free (ports);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jack_free (ports);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
JACKAudioBackend::get_connections (PortHandle port, vector<string>& s, bool process_callback_safe)
|
JACKAudioBackend::get_connections (PortHandle port, vector<string>& s, bool process_callback_safe)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user