13
0

more vst parameter related stuff

git-svn-id: svn://localhost/ardour2/branches/3.0@13119 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-08-09 16:55:56 +00:00
parent 3d07cbc37f
commit ff2fac11a0
2 changed files with 13 additions and 8 deletions

View File

@ -104,7 +104,10 @@ VSTPlugin::set_parameter (uint32_t which, float val)
{
float v = get_parameter (which);
cerr << name() << " setting parameter #" << which << " to " << val << " current " << v << " == ? " << (v == val) << " delta " << std::setprecision(15) << (v - val) << endl;
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)) {
return;

View File

@ -7,6 +7,8 @@
#ifndef __libpbd__floating_h__
#define __libpbd__floating_h__
#include <cmath>
namespace PBD {
union Float_t
@ -26,18 +28,18 @@ union Float_t
static inline bool floateq (float a, float b, int max_ulps_diff)
{
Float_t ua(a);
Float_t ub(b);
Float_t ua (a);
Float_t ub (b);
if (a == b) {
return true;
}
// Different signs means they do not match.
if (ua.negative() != ub.negative()) {
// Check for equality to make sure +0==-0
if (a == b) {
return true;
}
return false;
}
// Find the difference in ULPs.
int ulps_diff = abs (ua.i - ub.i);