* @param proc Processor to customize
* @param count number of plugin instances to use (if zero, reset to default)
* @param outs output port customization
+ * @param sinks input pins for variable-I/O plugins
* @returns true if successful
*/
- bool customize_plugin_insert (boost::shared_ptr<Processor> proc, uint32_t count, ChanCount outs);
+ bool customize_plugin_insert (boost::shared_ptr<Processor> proc, uint32_t count, ChanCount outs, ChanCount sinks);
bool add_remove_sidechain (boost::shared_ptr<Processor> proc, bool);
bool plugin_preset_output (boost::shared_ptr<Processor> proc, ChanCount outs);
}
+void
+PluginInsert::set_sinks (const ChanCount& c)
+{
+ bool changed = (_custom_sinks != c) && _custom_cfg;
+ _custom_sinks = c;
+ /* no signal, change will only be visible after re-config */
+}
+
void
PluginInsert::set_outputs (const ChanCount& c)
{
ChanCount old_in;
ChanCount old_internal;
ChanCount old_out;
+ ChanCount old_pins;
+ old_pins = natural_input_streams();
old_in = _configured_in;
old_out = _configured_out;
old_internal = _configured_internal;
break;
case Delegate:
{
- ChanCount dout (in); // hint
+ ChanCount din (_configured_internal);
+ ChanCount dout (din); // hint
if (_custom_cfg) {
+ if (_custom_sinks.n_total () > 0) {
+ din = _custom_sinks;
+ }
dout = _custom_out;
} else if (_preset_out.n_audio () > 0) {
dout.set (DataType::AUDIO, _preset_out.n_audio ());
}
if (out.n_audio () == 0) { out.set (DataType::AUDIO, 1); }
ChanCount useins;
- bool const r = _plugins.front()->can_support_io_configuration (_configured_internal, dout, &useins);
+ DEBUG_TRACE (DEBUG::ChanMapping, string_compose ("%1: Delegate lookup : %2 %3\n", name(), din, dout));
+ bool const r = _plugins.front()->can_support_io_configuration (din, dout, &useins);
assert (r);
if (useins.n_audio() == 0) {
- useins = _configured_internal;
+ useins = din;
}
DEBUG_TRACE (DEBUG::ChanMapping, string_compose ("%1: Delegate configuration: %2 %3\n", name(), useins, dout));
_configured = false;
return false;
}
+ if (!_custom_cfg) {
+ _custom_sinks = din;
+ }
}
break;
default:
natural_input_streams () + ChanCount::max (_configured_out, natural_output_streams () * get_count ()));
if (old_in != in || old_out != out || old_internal != _configured_internal
+ || old_pins != natural_input_streams ()
|| (old_match.method != _match.method && (old_match.method == Split || _match.method == Split))
) {
PluginIoReConfigure (); /* EMIT SIGNAL */
PluginInfoPtr info = _plugins.front()->get_info();
out = _custom_out;
if (info->reconfigurable_io()) {
- return Match (Delegate, get_count(), _strict_io, true);
+ return Match (Delegate, 1, _strict_io, true);
} else {
return Match (ExactMatch, get_count(), _strict_io, true);
}
/* remember actual i/o configuration (for later placeholder
* in case the plugin goes missing) */
node.add_child_nocopy (* _configured_in.state (X_("ConfiguredInput")));
+ node.add_child_nocopy (* _custom_sinks.state (X_("CustomSinks")));
node.add_child_nocopy (* _configured_out.state (X_("ConfiguredOutput")));
node.add_child_nocopy (* _preset_out.state (X_("PresetOutput")));
if ((*i)->name() == X_("ConfiguredInput")) {
_configured_in = ChanCount(**i);
}
+ if ((*i)->name() == X_("CustomSinks")) {
+ _custom_sinks = ChanCount(**i);
+ }
if ((*i)->name() == X_("ConfiguredOutput")) {
_custom_out = ChanCount(**i);
_configured_out = ChanCount(**i);
plugin->StartTouch.connect_same_thread (*this, boost::bind (&PluginInsert::start_touch, this, _1));
plugin->EndTouch.connect_same_thread (*this, boost::bind (&PluginInsert::end_touch, this, _1));
plugin->LatencyChanged.connect_same_thread (*this, boost::bind (&PluginInsert::latency_changed, this, _1, _2));
+ _custom_sinks = plugin->get_info()->n_inputs;
// cache sidechain port count
_cached_sidechain_pins.reset ();
const ChanCount& nis (plugin->get_info()->n_inputs);
Route::reset_plugin_insert (boost::shared_ptr<Processor> proc)
{
ChanCount unused;
- return customize_plugin_insert (proc, 0, unused);
+ return customize_plugin_insert (proc, 0, unused, unused);
}
bool
-Route::customize_plugin_insert (boost::shared_ptr<Processor> proc, uint32_t count, ChanCount outs)
+Route::customize_plugin_insert (boost::shared_ptr<Processor> proc, uint32_t count, ChanCount outs, ChanCount sinks)
{
boost::shared_ptr<PluginInsert> pi;
if ((pi = boost::dynamic_pointer_cast<PluginInsert>(proc)) == 0) {
Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ());
Glib::Threads::RWLock::WriterLock lm (_processor_lock);
- bool old_cust = pi->custom_cfg ();
- uint32_t old_cnt = pi->get_count ();
- ChanCount old_chan = pi->output_streams ();
+ bool old_cust = pi->custom_cfg ();
+ uint32_t old_cnt = pi->get_count ();
+ ChanCount old_chan = pi->output_streams ();
+ ChanCount old_sinks = pi->natural_input_streams ();
if (count == 0) {
pi->set_custom_cfg (false);
pi->set_custom_cfg (true);
pi->set_count (count);
pi->set_outputs (outs);
+ pi->set_sinks (sinks);
}
list<pair<ChanCount, ChanCount> > c = try_configure_processors_unlocked (n_inputs (), 0);
/* not possible */
pi->set_count (old_cnt);
+ pi->set_sinks (old_sinks);
pi->set_outputs (old_chan);
pi->set_custom_cfg (old_cust);