summaryrefslogtreecommitdiff
path: root/libs/ardour/route.cc
diff options
context:
space:
mode:
authorSampo Savolainen <v2@iki.fi>2006-01-26 19:00:38 +0000
committerSampo Savolainen <v2@iki.fi>2006-01-26 19:00:38 +0000
commitb751f4f2e219979c665a706ef09ca8b5d56cf36c (patch)
treecc9dc513d81c7d46d6aff8b41921a3c3e97d4fbe /libs/ardour/route.cc
parent3e8f74c5c4d80f780fb77611a2aded8cf4a02837 (diff)
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
Diffstat (limited to 'libs/ardour/route.cc')
-rw-r--r--libs/ardour/route.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 269ed98a77..5d3cd942e7 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -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);