Mercurial > hg > cepstral-pitchtracker
comparison NoteHypothesis.h @ 34:3fb9c657d86b
Expand hypothesis tests
author | Chris Cannam |
---|---|
date | Fri, 13 Jul 2012 22:48:02 +0100 |
parents | 5f2a57b1a75a |
children | 2f5b169e4a3b |
comparison
equal
deleted
inserted
replaced
33:5f2a57b1a75a | 34:3fb9c657d86b |
---|---|
50 | 50 |
51 struct Estimate { | 51 struct Estimate { |
52 Estimate() : freq(0), time(), confidence(0) { } | 52 Estimate() : freq(0), time(), confidence(0) { } |
53 Estimate(double _f, RealTime _t, double _c) : | 53 Estimate(double _f, RealTime _t, double _c) : |
54 freq(_f), time(_t), confidence(_c) { } | 54 freq(_f), time(_t), confidence(_c) { } |
55 bool operator==(const Estimate &e) const { | |
56 return e.freq == freq && e.time == time && e.confidence == confidence; | |
57 } | |
55 double freq; | 58 double freq; |
56 RealTime time; | 59 RealTime time; |
57 double confidence; | 60 double confidence; |
58 }; | 61 }; |
59 typedef std::vector<Estimate> Estimates; | 62 typedef std::vector<Estimate> Estimates; |
80 | 83 |
81 struct Note { | 84 struct Note { |
82 Note() : freq(0), time(), duration() { } | 85 Note() : freq(0), time(), duration() { } |
83 Note(double _f, RealTime _t, RealTime _d) : | 86 Note(double _f, RealTime _t, RealTime _d) : |
84 freq(_f), time(_t), duration(_d) { } | 87 freq(_f), time(_t), duration(_d) { } |
88 bool operator==(const Note &e) const { | |
89 return e.freq == freq && e.time == time && e.duration == duration; | |
90 } | |
85 double freq; | 91 double freq; |
86 RealTime time; | 92 RealTime time; |
87 RealTime duration; | 93 RealTime duration; |
88 }; | 94 }; |
89 | 95 |
96 /** | |
97 * Return the mean frequency of the accepted estimates | |
98 */ | |
99 double getMeanFrequency() const; | |
100 | |
90 /** | 101 /** |
91 * Return a single note roughly matching this hypothesis | 102 * Return a single note roughly matching this hypothesis |
92 */ | 103 */ |
93 Note getAveragedNote() const; | 104 Note getAveragedNote() const; |
94 | 105 |
95 private: | 106 private: |
96 bool isWithinTolerance(Estimate) const; | 107 bool isWithinTolerance(Estimate) const; |
97 bool isOutOfDateFor(Estimate) const; | 108 bool isOutOfDateFor(Estimate) const; |
98 bool isSatisfied() const; | 109 bool isSatisfied() const; |
99 double getMeanFrequency() const; | |
100 | 110 |
101 State m_state; | 111 State m_state; |
102 Estimates m_pending; | 112 Estimates m_pending; |
103 }; | 113 }; |
104 | 114 |