Add a scratch buffer for automation.
authorRobin Gareus <robin@gareus.org>
Sat, 3 Jun 2017 10:26:33 +0000 (12:26 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 3 Jun 2017 11:54:55 +0000 (13:54 +0200)
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
libs/ardour/ardour/session.h
libs/ardour/ardour/thread_buffers.h
libs/ardour/process_thread.cc
libs/ardour/session.cc
libs/ardour/thread_buffers.cc

index 0e1e7a64c31acad18a8ae7d73892f9f51792374c..31f91f44f4a9d19dfb5c0b331ea440cee230e8da 100644 (file)
@@ -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:
index f748adb15d251e849bc0e20e8677ec2ea80ea83f..2209fb268a12c2c81ee07768cd9279b9e1ed26d4 100644 (file)
@@ -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);
index 598d8f3947857a9bec96f21d5bf4ff80b4fcc7c6..12e549fe554b4d7ac1675989067949bd0a7f8d94 100644 (file)
@@ -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;
 
index 655ab3dfccbe878bb390ba79a1f50911415020ba..3864a898fa2d649fe4e998a3936b47b7db6cbe17 100644 (file)
@@ -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()
 {
index e5d73d642dfe388840cac8c4a0c516eeec070b52..80586acac38d940ce6cf5319c90aff8c9d25cecd 100644 (file)
@@ -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
 {
index 9b08f5c51304bdcfdca6ee28cee9be68b890c6d4..abd8e9d3338627fdb40c8e44f57c4b02839081a2 100644 (file)
@@ -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);
 }