diff NoteHypothesis.h @ 34:3fb9c657d86b

Expand hypothesis tests
author Chris Cannam
date Fri, 13 Jul 2012 22:48:02 +0100
parents 5f2a57b1a75a
children 2f5b169e4a3b
line wrap: on
line diff
--- a/NoteHypothesis.h	Fri Jul 13 22:14:01 2012 +0100
+++ b/NoteHypothesis.h	Fri Jul 13 22:48:02 2012 +0100
@@ -52,6 +52,9 @@
         Estimate() : freq(0), time(), confidence(0) { }
         Estimate(double _f, RealTime _t, double _c) :
             freq(_f), time(_t), confidence(_c) { }
+        bool operator==(const Estimate &e) const {
+            return e.freq == freq && e.time == time && e.confidence == confidence;
+        }
 	double freq;
 	RealTime time;
 	double confidence;
@@ -82,12 +85,20 @@
         Note() : freq(0), time(), duration() { }
         Note(double _f, RealTime _t, RealTime _d) :
             freq(_f), time(_t), duration(_d) { }
+        bool operator==(const Note &e) const {
+            return e.freq == freq && e.time == time && e.duration == duration;
+        }
 	double freq;
 	RealTime time;
 	RealTime duration;
     };
     
     /**
+     * Return the mean frequency of the accepted estimates
+     */
+    double getMeanFrequency() const;
+
+    /**
      * Return a single note roughly matching this hypothesis
      */
     Note getAveragedNote() const;
@@ -96,7 +107,6 @@
     bool isWithinTolerance(Estimate) const;
     bool isOutOfDateFor(Estimate) const;
     bool isSatisfied() const;
-    double getMeanFrequency() const;
     
     State m_state;
     Estimates m_pending;