process effect-automation when bouncing w/processing
authorRobin Gareus <robin@gareus.org>
Mon, 26 May 2014 04:17:49 +0000 (06:17 +0200)
committerRobin Gareus <robin@gareus.org>
Mon, 26 May 2014 04:55:56 +0000 (06:55 +0200)
libs/ardour/ardour/plugin_insert.h
libs/ardour/ardour/session.h
libs/ardour/plugin_insert.cc
libs/ardour/session.cc

index 627c8475139616f0e5a0788f3acd65a997905f34..f1c03a79d268b182efeed5ebe681b0fdc0778485 100644 (file)
@@ -177,7 +177,7 @@ class LIBARDOUR_API PluginInsert : public Processor
        /** details of the match currently being used */
        Match _match;
 
-       void automation_run (BufferSet& bufs, pframes_t nframes);
+       void automation_run (BufferSet& bufs, framepos_t start, pframes_t nframes);
        void connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t offset, bool with_auto, framepos_t now = 0);
 
        void create_automatable_parameters ();
index 40ada138a6dac0f8027d0536da423afbba66110a..a2949c59cc04d95fe3b3140fbb4274aedbff800c 100644 (file)
@@ -791,6 +791,10 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
                return _exporting;
        }
 
+       bool bounce_processing() const {
+               return _bounce_processing_active;
+       }
+
        /* this is a private enum, but setup_enum_writer() needs it,
           and i can't find a way to give that function
           friend access. sigh.
@@ -928,6 +932,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        mutable gint             processing_prohibited;
        process_function_type    process_function;
        process_function_type    last_process_function;
+       bool                    _bounce_processing_active;
        bool                     waiting_for_sync_offset;
        framecnt_t              _base_frame_rate;
        framecnt_t              _current_frame_rate;  //this includes video pullup offset
@@ -982,7 +987,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        void process_without_events (pframes_t);
        void process_with_events    (pframes_t);
        void process_audition       (pframes_t);
-        int  process_export         (pframes_t);
+       int  process_export         (pframes_t);
        int  process_export_fw      (pframes_t);
 
        void block_processing() { g_atomic_int_set (&processing_prohibited, 1); }
index 6fbb5cb67908de7f318ecc46d087b034bdff5bab..27cae70b62d8dbf41f6effa6b0f06ef3875bdea0 100644 (file)
@@ -455,13 +455,13 @@ PluginInsert::silence (framecnt_t nframes)
 }
 
 void
-PluginInsert::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t nframes, bool)
+PluginInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t /*end_frame*/, pframes_t nframes, bool)
 {
        if (_pending_active) {
                /* run as normal if we are active or moving from inactive to active */
 
-               if (_session.transport_rolling()) {
-                       automation_run (bufs, nframes);
+               if (_session.transport_rolling() || _session.bounce_processing()) {
+                       automation_run (bufs, start_frame, nframes);
                } else {
                        connect_and_run (bufs, nframes, 0, false);
                }
@@ -538,10 +538,10 @@ PluginInsert::get_parameter (Evoral::Parameter param)
 }
 
 void
-PluginInsert::automation_run (BufferSet& bufs, pframes_t nframes)
+PluginInsert::automation_run (BufferSet& bufs, framepos_t start, pframes_t nframes)
 {
        Evoral::ControlEvent next_event (0, 0.0f);
-       framepos_t now = _session.transport_frame ();
+       framepos_t now = start;
        framepos_t end = now + nframes;
        framecnt_t offset = 0;
 
index 4221dceb6ad5f99292c9436173f5523ed346c2e9..d6add56c6bdf89f3076160344df8e77e7c613ff1 100644 (file)
@@ -137,6 +137,7 @@ Session::Session (AudioEngine &eng,
        : playlists (new SessionPlaylists)
        , _engine (eng)
        , process_function (&Session::process_with_events)
+       , _bounce_processing_active (false)
        , waiting_for_sync_offset (false)
        , _base_frame_rate (0)
        , _current_frame_rate (0)
@@ -4169,6 +4170,8 @@ Session::write_one_track (AudioTrack& track, framepos_t start, framepos_t end,
                Glib::Threads::Mutex::Lock lm (_engine.process_lock());
        }
 
+       _bounce_processing_active = true;
+
        _engine.main_thread()->get_buffers ();
 
        /* call tree *MUST* hold route_lock */
@@ -4334,6 +4337,7 @@ Session::write_one_track (AudioTrack& track, framepos_t start, framepos_t end,
                }
        }
 
+       _bounce_processing_active = false;
 
        if (need_block_size_reset) {
                track.set_block_size (get_block_size());