13
0

allow zero-input (i.e. tone generator) processors to be added

git-svn-id: svn://localhost/ardour2/branches/3.0@8950 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-02-24 16:22:42 +00:00
parent 0193803126
commit e1905c1c29
2 changed files with 33 additions and 12 deletions

View File

@ -612,6 +612,20 @@ PluginInsert::can_support_io_configuration (const ChanCount& in, ChanCount& out)
ChanCount inputs = _plugins[0]->get_info()->n_inputs;
ChanCount outputs = _plugins[0]->get_info()->n_outputs;
bool no_inputs = true;
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
if (inputs.get (*t) != 0) {
no_inputs = false;
break;
}
}
if (no_inputs) {
/* no inputs so we can take any input configuration since we throw it away */
out = outputs;
return true;
}
// Plugin inputs match requested inputs exactly
if (inputs == in) {
out = outputs;
@ -624,12 +638,15 @@ PluginInsert::can_support_io_configuration (const ChanCount& in, ChanCount& out)
uint32_t f = 0;
bool can_replicate = true;
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
uint32_t nin = inputs.get (*t);
// No inputs of this type
if (inputs.get(*t) == 0 && in.get(*t) == 0) {
if (nin == 0 && in.get(*t) == 0) {
continue;
}
if (inputs.get(*t) != 1 || outputs.get (*t) != 1) {
if (nin != 1 || outputs.get (*t) != 1) {
can_replicate = false;
break;
}
@ -637,16 +654,16 @@ PluginInsert::can_support_io_configuration (const ChanCount& in, ChanCount& out)
// Potential factor not set yet
if (f == 0) {
f = in.get(*t) / inputs.get(*t);;
f = in.get(*t) / nin;
}
// Factor for this type does not match another type, can not replicate
if (f != (in.get(*t) / inputs.get(*t))) {
if (f != (in.get(*t) / nin)) {
can_replicate = false;
break;
}
}
if (can_replicate) {
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
out.set (*t, outputs.get(*t) * f);

View File

@ -503,13 +503,17 @@ Route::process_output_buffers (BufferSet& bufs,
break;
}
if (bufs.count() != (*i)->input_streams()) {
cerr << _name << " bufs = " << bufs.count()
<< " input for " << (*i)->name() << " = " << (*i)->input_streams()
<< endl;
}
assert (bufs.count() == (*i)->input_streams());
#ifndef NDEBUG
/* if it has any inputs, make sure they match */
if ((*i)->input_streams() != ChanCount::ZERO) {
if (bufs.count() != (*i)->input_streams()) {
cerr << _name << " bufs = " << bufs.count()
<< " input for " << (*i)->name() << " = " << (*i)->input_streams()
<< endl;
abort ();
}
}
#endif
/* should we NOT run plugins here if the route is inactive?
do we catch route != active somewhere higher?
*/