|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-08 14:31:16
|
Module: editor
Branch: master
Commit: dc6f4845743114ec328b0273ad6f607e1aa3ee0c
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Feb 8 13:26:30 2011 +0100
NaN safe handling peaks in Analyzer.
---
pitch.cc | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pitch.cc b/pitch.cc
index 0ac5924..85d159d 100644
--- a/pitch.cc
+++ b/pitch.cc
@@ -82,8 +82,8 @@ void Analyzer::calcTones() {
Combos combos;
for (size_t k = kMin; k < kMax; ++k) {
Peak const& p = m_peaks[k];
- if (p.level < 1e-4) continue;
- if (p.freq < FFT_MINFREQ || p.freq > FFT_MAXFREQ) continue;
+ bool ok = p.level > 1e-4 && p.freq >= FFT_MINFREQ && p.freq <= FFT_MAXFREQ;
+ if (!ok) continue;
// Do we need to add a new Combo (rather than using the last one)?
if (combos.empty() || !combos.back().match(p.freq)) combos.push_back(Combo());
combos.back().combine(p);
|