13
0

simplify "can-replicate" to allow replication only if a plugin has zero or one input AND output for each data type

git-svn-id: svn://localhost/ardour2/branches/3.0@8742 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-02-07 17:04:22 +00:00
parent 44d938b6b2
commit eb012ac243

View File

@ -619,35 +619,20 @@ PluginInsert::can_support_io_configuration (const ChanCount& in, ChanCount& out)
} }
// See if replication is possible // See if replication is possible
// We can replicate if there exists a single factor f such that, for every type, // We allow replication only for plugins with either zero or 1 inputs and outputs
// the number of plugin inputs * f = the requested number of inputs // for every valid data type.
uint32_t f = 0; uint32_t f = 1;
bool can_replicate = true; bool can_replicate = true;
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
// No inputs of this type // No inputs of this type
if (inputs.get(*t) == 0 && in.get(*t) == 0) { if (inputs.get(*t) == 0 && in.get(*t) == 0) {
continue; continue;
}
// Plugin has more inputs than requested, can not replicate if (inputs.get(*t) != 1 || outputs.get (*t) != 1) {
} else if (inputs.get(*t) >= in.get(*t)) { can_replicate = false;
can_replicate = false; break;
break; }
// Plugin inputs is not a factor of requested inputs, can not replicate
} else if (inputs.get(*t) == 0 || in.get(*t) % inputs.get(*t) != 0) {
can_replicate = false;
break;
// Potential factor not set yet
} else if (f == 0) {
f = in.get(*t) / inputs.get(*t);;
}
// Factor for this type does not match another type, can not replicate
if (f != (in.get(*t) / inputs.get(*t))) {
can_replicate = false;
break;
}
} }
if (can_replicate) { if (can_replicate) {