Add option to limit automatable control parmaters
[ardour.git] / libs / ardour / sidechain.cc
index dec5e1dc1f0059b1175f6fa9c729f52c57d43ffa..f326218453ce23bb0a732ae042cca57b29191639 100644 (file)
@@ -28,7 +28,7 @@
 #include "ardour/session.h"
 #include "ardour/sidechain.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace ARDOUR;
 using namespace PBD;
@@ -37,18 +37,18 @@ using namespace PBD;
 SideChain::SideChain (Session& s, const std::string& name)
        : IOProcessor (s, true, false, name)
 {
-
 }
 
 SideChain::~SideChain ()
 {
+       disconnect ();
 }
 
 XMLNode&
-SideChain::state(bool full)
+SideChain::state ()
 {
-       XMLNode& node = IOProcessor::state(full);
-       node.add_property ("type", "sidechain");
+       XMLNode& node = IOProcessor::state ();
+       node.set_property ("type", "sidechain");
        return node;
 }
 
@@ -56,32 +56,22 @@ SideChain::state(bool full)
 int
 SideChain::set_state (const XMLNode& node, int version)
 {
-       XMLNodeList nlist = node.children();
-       const XMLNode* insert_node = &node;
-
-       for (XMLNodeIterator niter = nlist.begin(); niter != nlist.end(); ++niter) {
-               if ((*niter)->name() == "IOProcessor") {
-                       insert_node = *niter;
-               }
-       }
-
-       IOProcessor::set_state (*insert_node, version);
-
+       IOProcessor::set_state (node, version);
        return 0;
 }
 
 void
-SideChain::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool)
+SideChain::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double /*speed*/, pframes_t nframes, bool)
 {
-       if (_input->n_ports() == ChanCount::ZERO) {
+       if (_input->n_ports () == ChanCount::ZERO) {
                // inplace pass-through
                return;
        }
 
-       if ((!_active && !_pending_active)) {
+       if (!_active && !_pending_active) {
                // zero buffers
-               for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
-                       for (uint32_t out = _configured_input.get (*t); out < bufs.count().get (*t); ++out) {
+               for (DataType::iterator t = DataType::begin (); t != DataType::end (); ++t) {
+                       for (uint32_t out = _configured_input.get (*t); out < bufs.count ().get (*t); ++out) {
                                bufs.get (*t, out).silence (nframes);
                        }
                }
@@ -89,7 +79,7 @@ SideChain::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, p
        }
 
        _input->collect_input (bufs, nframes, _configured_input);
-       bufs.set_count(_configured_output);
+       bufs.set_count (_configured_output);
 
        _active = _pending_active;
 }
@@ -97,16 +87,16 @@ SideChain::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, p
 bool
 SideChain::can_support_io_configuration (const ChanCount& in, ChanCount& out)
 {
-       out = in + _input->n_ports();
+       out = in + _input->n_ports ();
        return true;
 }
 
 bool
 SideChain::configure_io (ChanCount in, ChanCount out)
 {
-       if (out != in + _input->n_ports()) {
-               return false;
+       if (out != in + _input->n_ports ()) {
+               /* disabled for now - see PluginInsert::configure_io() */
+               // return false;
        }
-       Processor::configure_io(in, out);
-       return true;
+       return Processor::configure_io (in, out);
 }