Add AutomationControl::set_value_unchecked() and AutomationControl::writable() and...
[ardour.git] / libs / ardour / plugin_insert.cc
index ec6d86d71a76c66094fdba48db8e72065af82033..34745b7cabd933aea2f7b685dd6e2d5fffedf30f 100644 (file)
@@ -405,7 +405,16 @@ PluginInsert::connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t of
                                const float val = c->list()->rt_safe_eval (now, valid);
 
                                if (valid) {
-                                       c->set_value(val);
+                                       /* This is the ONLY place where we are
+                                        *  allowed to call
+                                        *  AutomationControl::set_value_unchecked(). We
+                                        *  know that the control is in
+                                        *  automation playback mode, so no
+                                        *  check on writable() is required
+                                        *  (which must be done in AutomationControl::set_value()
+                                        *
+                                        */
+                                       c->set_value_unchecked(val);
                                }
 
                        }
@@ -1294,6 +1303,14 @@ PluginInsert::PluginControl::PluginControl (PluginInsert*                     p,
 /** @param val `user' value */
 void
 PluginInsert::PluginControl::set_value (double user_val)
+{
+       if (writable()) {
+               set_value_unchecked (user_val);
+       }
+}
+
+void
+PluginInsert::PluginControl::set_value_unchecked (double user_val)
 {
        /* FIXME: probably should be taking out some lock here.. */
 
@@ -1359,6 +1376,14 @@ PluginInsert::PluginPropertyControl::PluginPropertyControl (PluginInsert*
 
 void
 PluginInsert::PluginPropertyControl::set_value (double user_val)
+{
+       if (writable()) {
+               set_value_unchecked (user_val);
+       }
+}
+
+void
+PluginInsert::PluginPropertyControl::set_value_unchecked (double user_val)
 {
        /* Old numeric set_value(), coerce to appropriate datatype if possible.
           This is lossy, but better than nothing until Ardour's automation system