# HG changeset patch # User Chris Cannam # Date 1541681736 0 # Node ID 37e9d6a1e00cfe20d806b5ace9a3d69d01fcffe3 # Parent 413e09f303ba277b34a410663df08bc807f1fc51 Retrieve only the values already determined to be peaks diff -r 413e09f303ba -r 37e9d6a1e00c layer/SpectrumLayer.cpp --- a/layer/SpectrumLayer.cpp Thu Nov 08 11:12:04 2018 +0000 +++ b/layer/SpectrumLayer.cpp Thu Nov 08 12:55:36 2018 +0000 @@ -679,14 +679,6 @@ getBiasCurve(curve); int cs = int(curve.size()); - std::vector values; - - for (int bin = 0; bin < fft->getHeight(); ++bin) { - double value = m_sliceableModel->getValueAt(col, bin); - if (bin < cs) value *= curve[bin]; - values.push_back(value); - } - for (FFTModel::PeakSet::iterator i = peaks.begin(); i != peaks.end(); ++i) { @@ -694,14 +686,16 @@ // cerr << "bin = " << bin << ", thresh = " << thresh << ", value = " << fft->getMagnitudeAt(col, bin) << endl; - if (!fft->isOverThreshold(col, bin, float(thresh))) continue; + double value = fft->getValueAt(col, bin); + if (value < thresh) continue; + if (bin < cs) value *= curve[bin]; double freq = i->second; - int x = int(lrint(getXForFrequency(v, freq))); - + double norm = 0.f; - (void)getYForValue(v, values[bin], norm); // don't need return value, need norm + // don't need return value, need norm: + (void)getYForValue(v, value, norm); paint.setPen(mapper.map(norm)); paint.drawLine(x, 0, x, v->getPaintHeight() - scaleHeight - 1);