|
From: Tapio V. <aa...@us...> - 2011-02-01 07:34:31
|
Module: editor
Branch: master
Commit: 1015e3ef9aa3a7ca358b6994ba2a54b4e65f7174
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 1 09:33:57 2011 +0200
Optimize pitch guessing a bit.
---
pitchvis.cc | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/pitchvis.cc b/pitchvis.cc
index 95e1e53..870bfe2 100644
--- a/pitchvis.cc
+++ b/pitchvis.cc
@@ -117,7 +117,11 @@ int PitchVis::guessNote(double begin, double end, int note) {
if (note >= 0 || note < 48) score[note] = 10.0; // Slightly prefer the current note
// Score against paths
for (PitchVis::Paths::const_iterator it = paths.begin(), itend = paths.end(); it != itend; ++it) {
+ // Discard paths completely outside the window
+ if (it->back().time < begin) continue;
+ if (it->front().time > end) break;
for (PitchPath::const_iterator it2 = it->begin(), it2end = it->end(); it2 != it2end; ++it2) {
+ // Discard path points outside the window
if (it2->time < begin) continue;
if (it2->time > end) break;
unsigned n = round(it2->note);
|