{
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;
};
}
*/
+#include "ardour/audio_buffer.h"
#include "ardour/unknown_processor.h"
#include "i18n.h"
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 &
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);
+ }
+}