comparison VampTestPlugin.cpp @ 37:bd22e6f4809d

Add eps to avoid rounding error
author Chris Cannam
date Tue, 28 Jan 2020 15:06:39 +0000
parents b35d5b2abf84
children 2ea9885df069
comparison
equal deleted inserted replaced
36:96cb7ef3cc24 37:bd22e6f4809d
458 f.label = s.str(); 458 f.label = s.str();
459 return f; 459 return f;
460 } 460 }
461 461
462 static 462 static
463 float snap(float x, float r) 463 double snap(double x, double r)
464 { 464 {
465 int n = int(x / r + 0.5); 465 double eps = 1e-9;
466 int n = int(x / r + 0.5 + eps);
466 return n * r; 467 return n * r;
467 } 468 }
468 469
469 Vamp::Plugin::FeatureSet 470 Vamp::Plugin::FeatureSet
470 VampTestPlugin::featuresFrom(RealTime timestamp, bool final) 471 VampTestPlugin::featuresFrom(RealTime timestamp, bool final)