From 0954efffd3a1d642be313aed9b5b7070eb307a9c Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 26 Mar 2016 00:40:51 +0100 Subject: add "no-inplace" buffers. When allowing to cross-connect plugin-ports, inplace processing can no longer be used. We need a complete set of independent input and output buffers. Since scratch and silent buffers are used by the various plugin implementations we cannot re-use them in the PluginInsert. Besides we need a complete BufferSet which can hold both: ins + outs. --- libs/ardour/ardour/process_thread.h | 1 + libs/ardour/ardour/session.h | 3 ++- libs/ardour/ardour/thread_buffers.h | 1 + libs/ardour/process_thread.cc | 19 +++++++++++++++++++ libs/ardour/session.cc | 6 ++++++ libs/ardour/thread_buffers.cc | 2 ++ 6 files changed, 31 insertions(+), 1 deletion(-) (limited to 'libs/ardour') diff --git a/libs/ardour/ardour/process_thread.h b/libs/ardour/ardour/process_thread.h index ee2e522378..cd1087f2a4 100644 --- a/libs/ardour/ardour/process_thread.h +++ b/libs/ardour/ardour/process_thread.h @@ -47,6 +47,7 @@ public: static BufferSet& get_silent_buffers (ChanCount count = ChanCount::ZERO); static BufferSet& get_scratch_buffers (ChanCount count = ChanCount::ZERO, bool silence = false); + static BufferSet& get_noinplace_buffers (ChanCount count = ChanCount::ZERO); static BufferSet& get_route_buffers (ChanCount count = ChanCount::ZERO, bool silence = false); static BufferSet& get_mix_buffers (ChanCount count = ChanCount::ZERO); static gain_t* gain_automation_buffer (); diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 9e0cf6ec08..49b9d7c45e 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -236,7 +236,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void process (pframes_t nframes); BufferSet& get_silent_buffers (ChanCount count = ChanCount::ZERO); - BufferSet& get_scratch_buffers (ChanCount count = ChanCount::ZERO, bool silence = true ); + BufferSet& get_noinplace_buffers (ChanCount count = ChanCount::ZERO); + BufferSet& get_scratch_buffers (ChanCount count = ChanCount::ZERO, bool silence = true); BufferSet& get_route_buffers (ChanCount count = ChanCount::ZERO, bool silence = true); BufferSet& get_mix_buffers (ChanCount count = ChanCount::ZERO); diff --git a/libs/ardour/ardour/thread_buffers.h b/libs/ardour/ardour/thread_buffers.h index f018ee4c22..598d8f3947 100644 --- a/libs/ardour/ardour/thread_buffers.h +++ b/libs/ardour/ardour/thread_buffers.h @@ -39,6 +39,7 @@ public: BufferSet* silent_buffers; BufferSet* scratch_buffers; + BufferSet* noinplace_buffers; BufferSet* route_buffers; BufferSet* mix_buffers; gain_t* gain_automation_buffer; diff --git a/libs/ardour/process_thread.cc b/libs/ardour/process_thread.cc index cf48c50c70..efcc47fee3 100644 --- a/libs/ardour/process_thread.cc +++ b/libs/ardour/process_thread.cc @@ -116,6 +116,25 @@ ProcessThread::get_scratch_buffers (ChanCount count, bool silence) return *sb; } +BufferSet& +ProcessThread::get_noinplace_buffers (ChanCount count) +{ + ThreadBuffers* tb = _private_thread_buffers.get(); + assert (tb); + + BufferSet* sb = tb->noinplace_buffers; + assert (sb); + + if (count != ChanCount::ZERO) { + assert(sb->available() >= count); + sb->set_count (count); + } else { + sb->set_count (sb->available()); + } + + return *sb; +} + BufferSet& ProcessThread::get_route_buffers (ChanCount count, bool silence) { diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index d668fb46e7..edae568645 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -5938,6 +5938,12 @@ Session::get_scratch_buffers (ChanCount count, bool silence) return ProcessThread::get_scratch_buffers (count, silence); } +BufferSet& +Session::get_noinplace_buffers (ChanCount count) +{ + return ProcessThread::get_noinplace_buffers (count); +} + BufferSet& Session::get_route_buffers (ChanCount count, bool silence) { diff --git a/libs/ardour/thread_buffers.cc b/libs/ardour/thread_buffers.cc index 2336ee50bc..36ffbb70da 100644 --- a/libs/ardour/thread_buffers.cc +++ b/libs/ardour/thread_buffers.cc @@ -30,6 +30,7 @@ using namespace std; ThreadBuffers::ThreadBuffers () : silent_buffers (new BufferSet) , scratch_buffers (new BufferSet) + , noinplace_buffers (new BufferSet) , route_buffers (new BufferSet) , mix_buffers (new BufferSet) , gain_automation_buffer (0) @@ -71,6 +72,7 @@ ThreadBuffers::ensure_buffers (ChanCount howmany, size_t custom) } scratch_buffers->ensure_buffers (*t, count, size); + noinplace_buffers->ensure_buffers (*t, count + count, size); // in + out mix_buffers->ensure_buffers (*t, count, size); silent_buffers->ensure_buffers (*t, count, size); route_buffers->ensure_buffers (*t, count, size); -- cgit v1.2.3