Mercurial > hg > svgui
changeset 1385:37e9d6a1e00c spectrogramparam
Retrieve only the values already determined to be peaks
author | Chris Cannam |
---|---|
date | Thu, 08 Nov 2018 12:55:36 +0000 |
parents | 413e09f303ba |
children | fc3d89f88690 |
files | layer/SpectrumLayer.cpp |
diffstat | 1 files changed, 6 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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<double> 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);