diff options
author | Robin Gareus <robin@gareus.org> | 2013-07-30 16:55:33 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2013-07-30 16:55:33 +0200 |
commit | 00f26394a9f4ec5264b67fc79c40bf648e0747bf (patch) | |
tree | 1a27ede2f3a88a695cdbed800aad74ba0f515008 /libs/ardour/process_thread.cc | |
parent | 44fc92c33d20537fb49cf2811028ea0c12383c32 (diff) |
use dedicated buffers for route (and track)
"scratch buffers are by definition scratch and their contents are undefined at all times"
"silent buffers are by definition all-zero and should not be used for real data"
But track & route were using those for actual data; plugins (which may run
in the same thread and may get the same buffers) use them for scratch thereby
overwriting real data.
In particular get_silent_buffers() (used by LadspaPlugin::connect_and_run)
clears the buffer which can holds real data:
e.g. via Route::passthru_silence() -> plugin1 -> plugin2 (clears output of plugin1)
Diffstat (limited to 'libs/ardour/process_thread.cc')
-rw-r--r-- | libs/ardour/process_thread.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libs/ardour/process_thread.cc b/libs/ardour/process_thread.cc index e10ccf160c..2ffb47a0df 100644 --- a/libs/ardour/process_thread.cc +++ b/libs/ardour/process_thread.cc @@ -109,6 +109,33 @@ ProcessThread::get_scratch_buffers (ChanCount count) } BufferSet& +ProcessThread::get_route_buffers (ChanCount count, bool silence) +{ + ThreadBuffers* tb = _private_thread_buffers.get(); + assert (tb); + + BufferSet* sb = tb->scratch_buffers; + assert (sb); + + if (count != ChanCount::ZERO) { + assert(sb->available() >= count); + sb->set_count (count); + } else { + sb->set_count (sb->available()); + } + + if (silence) { + for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { + for (size_t i= 0; i < count.get(*t); ++i) { + sb->get(*t, i).clear(); + } + } + } + + return *sb; +} + +BufferSet& ProcessThread::get_mix_buffers (ChanCount count) { ThreadBuffers* tb = _private_thread_buffers.get(); |