make sure that rec-enable changes get to do their non-RT stuff before being queued...
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 4 Jul 2016 13:25:31 +0000 (09:25 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 4 Jul 2016 13:27:33 +0000 (09:27 -0400)
libs/ardour/ardour/automation_control.h
libs/ardour/ardour/record_enable_control.h
libs/ardour/record_enable_control.cc

index ecc16cb13482cc7e4ddf6e835e410c516635add7..e15abbec46ce58f0594b526d696b9b557c169b2c 100644 (file)
@@ -134,6 +134,12 @@ class LIBARDOUR_API AutomationControl
 
        virtual void actually_set_value (double value, PBD::Controllable::GroupControlDisposition);
 
+       /* Session needs to call this method before it queues up the real
+          change for execution in a realtime context. C++ access control sucks.
+       */
+       friend class Session;
+       virtual void do_pre_realtime_queue_stuff (double new_value) {}
+
   private:
        /* I am unclear on why we have to make ControlGroup a friend in order
           to get access to the ::set_group() method when it is already
index d631c500a3dd0d95a5956daa6d7f5612703a6af2..c5cb65c597d5b5bbb4951643e76f05026571338d 100644 (file)
@@ -50,6 +50,7 @@ class LIBARDOUR_API RecordEnableControl : public SlavableAutomationControl
 
   protected:
        void actually_set_value (double val, Controllable::GroupControlDisposition gcd);
+       void do_pre_realtime_queue_stuff (double value);
 
   private:
        Recordable& _recordable;
index f71fd5034bb665bdb2cabee2428d1e445cacd4b6..67375e74317325863676ba9e976b9bff95dccd7d 100644 (file)
@@ -39,21 +39,6 @@ RecordEnableControl::RecordEnableControl (Session& session, std::string const &
 void
 RecordEnableControl::set_value (double val, Controllable::GroupControlDisposition gcd)
 {
-       /* do the non-RT part of rec-enabling first - the RT part will be done
-        * on the next process cycle. This does mean that theoretically we are
-        * doing things provisionally on the assumption that the rec-enable
-        * change will work, but this had better be a solid assumption for
-        * other reasons.
-        */
-
-       if (!AudioEngine::instance()->in_process_thread()) {
-               if (_recordable.prep_record_enabled (val)) {
-                       /* failed */
-                       std::cerr << "Prep rec-enable failed\n";
-                       return;
-               }
-       }
-
        /* Because we are marked as a RealTime control, this will queue
           up the control change to be executed in a realtime context.
        */
@@ -71,3 +56,20 @@ RecordEnableControl::actually_set_value (double val, Controllable::GroupControlD
        SlavableAutomationControl::actually_set_value (val, gcd);
 }
 
+void
+RecordEnableControl::do_pre_realtime_queue_stuff (double newval)
+{
+       /* do the non-RT part of rec-enabling first - the RT part will be done
+        * on the next process cycle. This does mean that theoretically we are
+        * doing things provisionally on the assumption that the rec-enable
+        * change will work, but this had better be a solid assumption for
+        * other reasons.
+        *
+        * this is guaranteed to be called from a non-process thread.
+        */
+
+       if (_recordable.prep_record_enabled (newval)) {
+               /* failed */
+               std::cerr << "Prep rec-enable failed\n";
+       }
+}