implement stub UnknownProcessor
authorRobin Gareus <robin@gareus.org>
Sat, 15 Aug 2015 18:19:30 +0000 (20:19 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 15 Aug 2015 21:28:50 +0000 (23:28 +0200)
libs/ardour/ardour/unknown_processor.h
libs/ardour/unknown_processor.cc

index 50234e8294a24b770e2e3535a040748cdddacac2..b9743c959938fbdcf261e4fd2f11905605c60788 100644 (file)
@@ -43,20 +43,18 @@ class LIBARDOUR_API UnknownProcessor : public Processor
 {
 public:
        UnknownProcessor (Session &, XMLNode const &);
+       virtual ~UnknownProcessor ();
 
-       /* These processors are hidden from view */
-       bool display_to_user () const {
-               return false;
-       }
-
-       bool can_support_io_configuration (const ChanCount &, ChanCount &) {
-               return false;
-       }
+       bool can_support_io_configuration (const ChanCount &, ChanCount &);
+       void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t /*nframes*/, bool /*result_required*/);
 
        XMLNode & state (bool);
 
 private:
        XMLNode _state;
+       bool      have_ioconfig;
+       ChanCount *saved_input;
+       ChanCount *saved_output;
 };
 
 }
index f6c713404f5d6ef6af3db8b6df9371cd6b331255..4bf4ebeaefe5df60c0c470fcc56a4d3526382d3b 100644 (file)
@@ -17,6 +17,7 @@
 
 */
 
+#include "ardour/audio_buffer.h"
 #include "ardour/unknown_processor.h"
 
 #include "i18n.h"
@@ -27,11 +28,34 @@ using namespace ARDOUR;
 UnknownProcessor::UnknownProcessor (Session& s, XMLNode const & state)
        : Processor (s, "")
        , _state (state)
+       , have_ioconfig (false)
+       , saved_input (0)
+       , saved_output (0)
 {
        XMLProperty const * prop = state.property (X_("name"));
        if (prop) {
                set_name (prop->value ());
+               _display_to_user = true;
        }
+
+       int have_io = 0;
+       XMLNodeList kids = state.children ();
+       for (XMLNodeIterator i = kids.begin(); i != kids.end(); ++i) {
+               if ((*i)->name() == X_("ConfiguredInput")) {
+                       have_io |= 1;
+                       saved_input = new ChanCount(**i);
+               }
+               if ((*i)->name() == X_("ConfiguredOutput")) {
+                       have_io |= 2;
+                       saved_output = new ChanCount(**i);
+               }
+       }
+       have_ioconfig = (have_io == 3);
+}
+
+UnknownProcessor::~UnknownProcessor () {
+       delete saved_input;;
+       delete saved_output;
 }
 
 XMLNode &
@@ -40,3 +64,23 @@ UnknownProcessor::state (bool)
        return *(new XMLNode (_state));
 }
 
+bool
+UnknownProcessor::can_support_io_configuration (const ChanCount &in, ChanCount & out) {
+       if (have_ioconfig && in == *saved_input) {
+               out = *saved_output;
+               return true;
+       }
+       return false;
+}
+
+void
+UnknownProcessor::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t nframes, bool)
+{
+       if (!have_ioconfig) {
+               return;
+       }
+       // silence excess output buffers
+       for (uint32_t i = saved_input->n_audio(); i < saved_output->n_audio(); ++i) {
+               bufs.get_audio (i).silence (nframes);
+       }
+}