From e61c2aeda34b345e5edcf71d195ee6e140b44850 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 9 Aug 2012 17:59:43 +0000 Subject: [PATCH] test a different approach to propagating plugin parameter changes (VST only for now) git-svn-id: svn://localhost/ardour2/branches/3.0@13122 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/vst_plugin.cc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index d3bcc6ecdd..3885bc2a1c 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -100,24 +100,22 @@ VSTPlugin::get_parameter (uint32_t which) const } void -VSTPlugin::set_parameter (uint32_t which, float val) +VSTPlugin::set_parameter (uint32_t which, float newval) { - float v = get_parameter (which); + float oldval = get_parameter (which); - cerr << name() << " setting parameter #" << which << " to " << val << " current " << v << " == ? " - << (v == val) << " floateq ? " << floateq (v, val, 1) << " delta " - << std::setprecision(15) - << (v - val) << endl; - - if (PBD::floateq (get_parameter (which), val, 1)) { + if (PBD::floateq (oldval, newval, 1)) { return; } - _plugin->setParameter (_plugin, which, val); + _plugin->setParameter (_plugin, which, newval); + + float curval = get_parameter (which); - cerr << "\thaving set parameter to " << val << " new value is " << get_parameter (which) << endl; - - Plugin::set_parameter (which, val); + if (!PBD::floateq (curval, oldval, 1)) { + /* value has changed, follow rest of the notification path */ + Plugin::set_parameter (which, newval); + } } uint32_t