From 0c57199a6ca4e6681ad934873dc107f0ef83a8ee Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 3 Jun 2017 12:26:33 +0200 Subject: Add a scratch buffer for automation. Useful as temporary buffer: This allows a controllable to get a master's automation-curve and combine it with its own (gain, trim, send) automation buffer. --- libs/ardour/ardour/process_thread.h | 1 + libs/ardour/ardour/session.h | 1 + libs/ardour/ardour/thread_buffers.h | 1 + libs/ardour/process_thread.cc | 11 +++++++++++ libs/ardour/session.cc | 6 ++++++ libs/ardour/thread_buffers.cc | 3 +++ 6 files changed, 23 insertions(+) diff --git a/libs/ardour/ardour/process_thread.h b/libs/ardour/ardour/process_thread.h index 0e1e7a64c3..31f91f44f4 100644 --- a/libs/ardour/ardour/process_thread.h +++ b/libs/ardour/ardour/process_thread.h @@ -51,6 +51,7 @@ public: static gain_t* gain_automation_buffer (); static gain_t* trim_automation_buffer (); static gain_t* send_gain_automation_buffer (); + static gain_t* scratch_automation_buffer (); static pan_t** pan_automation_buffer (); protected: diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index f748adb15d..2209fb268a 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1034,6 +1034,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop gain_t* gain_automation_buffer () const; gain_t* trim_automation_buffer () const; gain_t* send_gain_automation_buffer () const; + gain_t* scratch_automation_buffer () const; pan_t** pan_automation_buffer () const; void ensure_buffer_set (BufferSet& buffers, const ChanCount& howmany); diff --git a/libs/ardour/ardour/thread_buffers.h b/libs/ardour/ardour/thread_buffers.h index 598d8f3947..12e549fe55 100644 --- a/libs/ardour/ardour/thread_buffers.h +++ b/libs/ardour/ardour/thread_buffers.h @@ -45,6 +45,7 @@ public: gain_t* gain_automation_buffer; gain_t* trim_automation_buffer; gain_t* send_gain_automation_buffer; + gain_t* scratch_automation_buffer; pan_t** pan_automation_buffer; uint32_t npan_buffers; diff --git a/libs/ardour/process_thread.cc b/libs/ardour/process_thread.cc index 655ab3dfcc..3864a898fa 100644 --- a/libs/ardour/process_thread.cc +++ b/libs/ardour/process_thread.cc @@ -208,6 +208,17 @@ ProcessThread::send_gain_automation_buffer() return g; } +gain_t* +ProcessThread::scratch_automation_buffer() +{ + ThreadBuffers* tb = _private_thread_buffers.get(); + assert (tb); + + gain_t* g = tb->scratch_automation_buffer; + assert (g); + return g; +} + pan_t** ProcessThread::pan_automation_buffer() { diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index e5d73d642d..80586acac3 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -6301,6 +6301,12 @@ Session::send_gain_automation_buffer() const return ProcessThread::send_gain_automation_buffer (); } +gain_t* +Session::scratch_automation_buffer() const +{ + return ProcessThread::scratch_automation_buffer (); +} + pan_t** Session::pan_automation_buffer() const { diff --git a/libs/ardour/thread_buffers.cc b/libs/ardour/thread_buffers.cc index 9b08f5c513..abd8e9d333 100644 --- a/libs/ardour/thread_buffers.cc +++ b/libs/ardour/thread_buffers.cc @@ -36,6 +36,7 @@ ThreadBuffers::ThreadBuffers () , gain_automation_buffer (0) , trim_automation_buffer (0) , send_gain_automation_buffer (0) + , scratch_automation_buffer (0) , pan_automation_buffer (0) , npan_buffers (0) { @@ -86,6 +87,8 @@ ThreadBuffers::ensure_buffers (ChanCount howmany, size_t custom) trim_automation_buffer = new gain_t[audio_buffer_size]; delete [] send_gain_automation_buffer; send_gain_automation_buffer = new gain_t[audio_buffer_size]; + delete [] scratch_automation_buffer; + scratch_automation_buffer = new gain_t[audio_buffer_size]; allocate_pan_automation_buffers (audio_buffer_size, howmany.n_audio(), false); } -- cgit v1.2.3