add API to use a plugin provided bypass control port
[ardour.git] / libs / ardour / port_manager.cc
index 874d36d8828ae19730fa968046d25449aa490f22..1eafca0574934935002c7a0710a9553ce6339406 100644 (file)
@@ -28,6 +28,7 @@
 #include "ardour/midiport_manager.h"
 #include "ardour/port_manager.h"
 #include "ardour/profile.h"
+#include "ardour/session.h"
 
 #include "i18n.h"
 
@@ -158,6 +159,7 @@ void
 PortManager::get_physical_outputs (DataType type, std::vector<std::string>& s)
 {
        if (!_backend) {
+               s.clear ();
                return;
        }
        _backend->get_physical_outputs (type, s);
@@ -167,6 +169,7 @@ void
 PortManager::get_physical_inputs (DataType type, std::vector<std::string>& s)
 {
        if (!_backend) {
+               s.clear ();
                return;
        }
 
@@ -385,6 +388,40 @@ PortManager::connected (const string& port_name)
        return _backend->connected (handle);
 }
 
+bool
+PortManager::physically_connected (const string& port_name)
+{
+       if (!_backend) {
+               return false;
+       }
+
+       PortEngine::PortHandle handle = _backend->get_port_by_name (port_name);
+
+       if (!handle) {
+               return false;
+       }
+
+       return _backend->physically_connected (handle);
+}
+
+int
+PortManager::get_connections (const string& port_name, std::vector<std::string>& s)
+{
+       if (!_backend) {
+               s.clear ();
+               return 0;
+       }
+
+       PortEngine::PortHandle handle = _backend->get_port_by_name (port_name);
+
+       if (!handle) {
+               s.clear ();
+               return 0;
+       }
+
+       return _backend->get_connections (handle, s);
+}
+
 int
 PortManager::connect (const string& source, const string& destination)
 {
@@ -629,9 +666,18 @@ PortManager::cycle_end (pframes_t nframes)
 }
 
 void
-PortManager::silence (pframes_t nframes)
+PortManager::silence (pframes_t nframes, Session *s)
 {
        for (Ports::iterator i = _cycle_ports->begin(); i != _cycle_ports->end(); ++i) {
+               if (s && i->second == s->mtc_output_port ()) {
+                       continue;
+               }
+               if (s && i->second == s->midi_clock_output_port ()) {
+                       continue;
+               }
+               if (s && i->second == s->ltc_output_port ()) {
+                       continue;
+               }
                if (i->second->sends_output()) {
                        i->second->get_buffer(nframes).silence(nframes);
                }