13
0

implement stub UnknownProcessor

This commit is contained in:
Robin Gareus 2015-08-15 20:19:30 +02:00
parent 3dd3c35dfe
commit f7a670bc79
2 changed files with 50 additions and 8 deletions

View 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;
};
}

View 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);
}
}