Yamaha-PSR-S900.midnam: correct organ flutes, duplicate settings generated from fault...
[ardour.git] / libs / ardour / vst_plugin.cc
index dbc64f1ea88ae13f7289b69d8c122b0b319a1bff..3885bc2a1cab8fd2c42bf302495bab952d202e90 100644 (file)
@@ -23,6 +23,7 @@
 #include <glibmm/fileutils.h>
 #include <glibmm/miscutils.h>
 
+#include "pbd/floating.h"
 #include "pbd/locale_guard.h"
 #include "pbd/pathscanner.h"
 
@@ -99,18 +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) << endl;
-
-       if (get_parameter (which) == val) {
+       if (PBD::floateq (oldval, newval, 1)) {
                return;
        }
 
-       _plugin->setParameter (_plugin, which, val);
-       Plugin::set_parameter (which, val);
+       _plugin->setParameter (_plugin, which, newval);
+       
+       float curval = get_parameter (which);
+
+       if (!PBD::floateq (curval, oldval, 1)) {
+               /* value has changed, follow rest of the notification path */
+               Plugin::set_parameter (which, newval);
+       }
 }
 
 uint32_t