Ensure that there are enough peak vectors when a plugin redirect has

more inputs or outputs than the route has inputs or outputs.


git-svn-id: svn://localhost/trunk/ardour2@298 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Sampo Savolainen 2006-01-26 19:00:38 +00:00
parent 3e8f74c5c4
commit b751f4f2e2

View File

@ -776,6 +776,8 @@ Route::add_redirect (Redirect *redirect, void *src, uint32_t* err_streams)
PluginInsert* pi;
PortInsert* porti;
uint32_t potential_max_streams = 0;
if ((pi = dynamic_cast<PluginInsert*>(redirect)) != 0) {
pi->set_count (1);
@ -784,6 +786,8 @@ Route::add_redirect (Redirect *redirect, void *src, uint32_t* err_streams)
_have_internal_generator = true;
}
potential_max_streams = max(pi->input_streams(), pi->output_streams());
} else if ((porti = dynamic_cast<PortInsert*>(redirect)) != 0) {
/* force new port inserts to start out with an i/o configuration
@ -801,6 +805,14 @@ Route::add_redirect (Redirect *redirect, void *src, uint32_t* err_streams)
porti->ensure_io (n_outputs (), n_inputs(), false, this);
}
// Ensure peak vector sizes before the plugin is activated
while (_peak_power.size() < potential_max_streams) {
_peak_power.push_back(0);
}
while (_stored_peak_power.size() < potential_max_streams) {
_stored_peak_power.push_back(0);
}
_redirects.push_back (redirect);
if (_reset_plugin_counts (err_streams)) {
@ -837,12 +849,26 @@ Route::add_redirects (const RedirectList& others, void *src, uint32_t* err_strea
RedirectList::iterator existing_end = _redirects.end();
--existing_end;
uint32_t potential_max_streams = 0;
for (RedirectList::const_iterator i = others.begin(); i != others.end(); ++i) {
PluginInsert* pi;
if ((pi = dynamic_cast<PluginInsert*>(*i)) != 0) {
pi->set_count (1);
uint32_t m = max(pi->input_streams(), pi->output_streams());
if (m > potential_max_streams)
potential_max_streams = m;
}
// Ensure peak vector sizes before the plugin is activated
while (_peak_power.size() < potential_max_streams) {
_peak_power.push_back(0);
}
while (_stored_peak_power.size() < potential_max_streams) {
_stored_peak_power.push_back(0);
}
_redirects.push_back (*i);