Wouldn't it be nice if plugin presets had a description/comment?
[ardour.git] / libs / ardour / unknown_processor.cc
index 4bf4ebeaefe5df60c0c470fcc56a4d3526382d3b..3a5ad42f98f1f3b96f91f872ad306391bd7715c7 100644 (file)
@@ -20,7 +20,7 @@
 #include "ardour/audio_buffer.h"
 #include "ardour/unknown_processor.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
@@ -59,7 +59,7 @@ UnknownProcessor::~UnknownProcessor () {
 }
 
 XMLNode &
-UnknownProcessor::state (bool)
+UnknownProcessor::state ()
 {
        return *(new XMLNode (_state));
 }
@@ -69,12 +69,49 @@ UnknownProcessor::can_support_io_configuration (const ChanCount &in, ChanCount &
        if (have_ioconfig && in == *saved_input) {
                out = *saved_output;
                return true;
+       } else if (!have_ioconfig) {
+               /* pass for old sessions.
+                *
+                * session load assumes processor config succeeds.
+                * if initial configuration fails, processors downstream
+                * remain unconfigured and at least the panner will assert/segfault.
+                *
+                * This may still result in impossible setup, however
+                * Route::configure_processors_unlocked() ignores configure_io() return value
+                * in the inner loop and configures all available processors.
+                *
+                * It can still lead to segfaults IFF the track has no inputs and this is a
+                * generator (processor_max_streams will be zero).
+                */
+               PBD::warning << _("Using plugin-stub with unknown i/o configuration for: ") << name() << endmsg;
+#if 0
+               /* No output channels are fine (or should be, there may be edge-cases with e.g sends).
+                *
+                * Discussion needed.
+                *
+                * This is the safer option (no audio output, no possible damage)
+                * and the way to go in the long run.
+                * An even better solution is to disable the route if there are missing plugins
+                * and/or impossible configurations.
+                *
+                * Currently no output channels results in awkward GUI route display and also
+                * breaks semantics in mixbus (which assumes that the route has channels required
+                * for the always present mixer-strip plugin).
+                */
+               out = ChanCount ();
+#else
+               out = in;
+#endif
+               return true;
+       } else {
+               PBD::error << _("Using plugin-stub with mismatching i/o configuration for: ") << name() << endmsg;
+               out = in;
        }
-       return false;
+       return true;
 }
 
 void
-UnknownProcessor::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t nframes, bool)
+UnknownProcessor::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t nframes, bool)
 {
        if (!have_ioconfig) {
                return;