Mercurial > hg > svgui
diff layer/SpectrumLayer.cpp @ 1391:c39f2d439d59 spectrogramparam
Toward highlighting peaks on spectrum
author | Chris Cannam |
---|---|
date | Tue, 13 Nov 2018 15:16:48 +0000 |
parents | 1eb560b363e7 |
children | 900bed394f5a |
line wrap: on
line diff
--- a/layer/SpectrumLayer.cpp Tue Nov 13 14:48:42 2018 +0000 +++ b/layer/SpectrumLayer.cpp Tue Nov 13 15:16:48 2018 +0000 @@ -709,6 +709,11 @@ int xorigin = getVerticalScaleWidth(v, false, paint) + 1; int scaleHeight = getHorizontalScaleHeight(v, paint); + QPoint localPos; + bool shouldIlluminate = v->shouldIlluminateLocalFeatures(this, localPos); + + cerr << "shouldIlluminate = " << shouldIlluminate << ", localPos = " << localPos.x() << "," << localPos.y() << endl; + if (fft && m_showPeaks) { // draw peak lines @@ -738,6 +743,8 @@ int px = -1; + int fuzz = ViewManager::scalePixelSize(2); + for (FFTModel::PeakSet::iterator i = peaks.begin(); i != peaks.end(); ++i) { @@ -746,7 +753,7 @@ if (x == px) { continue; } - + int bin = i->first; // cerr << "bin = " << bin << ", thresh = " << thresh << ", value = " << fft->getMagnitudeAt(col, bin) << endl; @@ -754,6 +761,12 @@ double value = fft->getValueAt(col, bin); if (value < thresh) continue; if (bin < cs) value *= curve[bin]; + + bool highlightThis = false; + if (std::abs(localPos.x() - x) <= fuzz) { + highlightThis = true; + cerr << "should highlight this one (at " << x << ")" << endl; + } double norm = 0.f; // don't need return value, need norm: