summaryrefslogtreecommitdiff
path: root/src/loris/PartialBuilder.h
diff options
context:
space:
mode:
authorJohn Glover <j@johnglover.net>2012-09-12 20:18:35 +0200
committerJohn Glover <j@johnglover.net>2012-09-12 20:18:35 +0200
commit8467ad77e981f628911ae31847a23e905a2d96c6 (patch)
tree58bb6ceed5db4d665c83c872bee18857fd143df1 /src/loris/PartialBuilder.h
parent35f74ab36af2487423b2ef7b7d22438efe2e9fbd (diff)
downloadsimpl-8467ad77e981f628911ae31847a23e905a2d96c6.tar.gz
simpl-8467ad77e981f628911ae31847a23e905a2d96c6.tar.bz2
simpl-8467ad77e981f628911ae31847a23e905a2d96c6.zip
[partial_tracking] Bug fix: Add custom implementation of
Loris PartialBuilder::buildPartials that works in real-time.
Diffstat (limited to 'src/loris/PartialBuilder.h')
-rw-r--r--src/loris/PartialBuilder.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/loris/PartialBuilder.h b/src/loris/PartialBuilder.h
index 2592ffc..0459010 100644
--- a/src/loris/PartialBuilder.h
+++ b/src/loris/PartialBuilder.h
@@ -94,6 +94,7 @@ public:
// be un-normalized by calling finishBuilding at the end of the building
// process.
void buildPartials( Peaks & peaks, double frameTime );
+ void buildPartials( Peaks & peaks );
// finishBuilding
//
@@ -104,16 +105,38 @@ public:
// supplied PartialList.
void finishBuilding( PartialList & product );
+ // getPartials
+ //
+ // Return partials
+ void getPartials( PartialList & product );
+ Peaks & getPartials();
+
+ // maxPartials
+ //
+ // Change the maximum number of partials per frame
+ void maxPartials(int max);
+
+ // reset
+ //
+ // Reset the current partial list
+ void reset();
+
private:
// --- auxiliary member functions ---
double freq_distance( const Partial & partial, const SpectralPeak & pk );
+ double freq_distance( const SpectralPeak & pk1, const SpectralPeak & pk2 );
bool better_match( const Partial & part, const SpectralPeak & pk1,
const SpectralPeak & pk2 );
bool better_match( const Partial & part1,
const Partial & part2, const SpectralPeak & pk );
+ bool better_match( const SpectralPeak & pk1, const SpectralPeak & pk2,
+ const SpectralPeak & pk3 );
+
+ int getNextActive(int start);
+ int getNextInactive(int start);
// --- collected partials ---
@@ -122,8 +145,11 @@ private:
// --- builder state variables ---
+ std::vector<bool> mActivePartials;
+ std::vector<bool> mMatchedPartials;
PartialPtrs mEligiblePartials;
PartialPtrs mNewlyEligible; // keep track of eligible partials here
+ Peaks mCurrentPartials;
// --- parameters ---