diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-10-21 22:31:30 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-10-21 22:31:35 -0400 |
commit | 8d3a8ca9136c3fb8a8bd24dd5d99c8e2e76699bd (patch) | |
tree | 86e9cb3829a6a49647c57ae6a9a2d0b15c665a38 /libs/ardour/plugin_insert.cc | |
parent | 6ca3a1593e1467e057637e5ba863ca613e576eb8 (diff) |
Add AutomationControl::set_value_unchecked() and AutomationControl::writable() and use them.
Classes derived from AutomationControl now check ::writable() in their ::set_value() methods to ensure that they
do not attempt to overwrite data sent to them while automation playback is underway.
Diffstat (limited to 'libs/ardour/plugin_insert.cc')
-rw-r--r-- | libs/ardour/plugin_insert.cc | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index ec6d86d71a..34745b7cab 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -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); } } @@ -1295,6 +1304,14 @@ PluginInsert::PluginControl::PluginControl (PluginInsert* p, 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.. */ for (Plugins::iterator i = _plugin->_plugins.begin(); i != _plugin->_plugins.end(); ++i) { @@ -1360,6 +1377,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 can handle various datatypes all the way down. */ |