summaryrefslogtreecommitdiff
path: root/libs/ardour/process_thread.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2013-08-01 00:35:24 +0200
committerRobin Gareus <robin@gareus.org>2013-08-01 00:35:24 +0200
commit4dc74ae2ea13d2e5a8b481961d507df1ff98df97 (patch)
tree78dec5b3fc587a50e111e554478eb07475831594 /libs/ardour/process_thread.cc
parentf81cbe06ea3439d0c58057ae40ea63f1b6bf484b (diff)
use zeroed scratch buffers for "silent" plugin runs
Plugins rewrite the buffer data in-place and some plugins can produce output even when fed with silence. Hence, during a PluginInsert::silence() run a plugin can inject data into the "silent" buffers which causes side-effects. Kudos to Chris 'oofus' Goddard for finding this issue.
Diffstat (limited to 'libs/ardour/process_thread.cc')
-rw-r--r--libs/ardour/process_thread.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/libs/ardour/process_thread.cc b/libs/ardour/process_thread.cc
index 5d8d6f34fd..d4a3d2f390 100644
--- a/libs/ardour/process_thread.cc
+++ b/libs/ardour/process_thread.cc
@@ -90,7 +90,7 @@ ProcessThread::get_silent_buffers (ChanCount count)
}
BufferSet&
-ProcessThread::get_scratch_buffers (ChanCount count)
+ProcessThread::get_scratch_buffers (ChanCount count, bool silence)
{
ThreadBuffers* tb = _private_thread_buffers.get();
assert (tb);
@@ -105,6 +105,14 @@ ProcessThread::get_scratch_buffers (ChanCount count)
sb->set_count (sb->available());
}
+ if (silence) {
+ for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
+ for (uint32_t i = 0; i < sb->count().get(*t); ++i) {
+ sb->get(*t, i).clear();
+ }
+ }
+ }
+
return *sb;
}