# HG changeset patch # User Chris Cannam # Date 1233855994 0 # Node ID 363157772fbd485c4eb14b987d159a96ea946c72 # Parent 5cd6f0d3f42deba3297e6d60e9368a51d36baf8d * Restore peak bins mode in spectrogram diff -r 5cd6f0d3f42d -r 363157772fbd layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Thu Feb 05 17:33:21 2009 +0000 +++ b/layer/SpectrogramLayer.cpp Thu Feb 05 17:46:34 2009 +0000 @@ -2704,8 +2704,19 @@ for (int sy = sy0; sy < sy1; ++sy) { float value = 0.f; - if (fft) value = values[sy - minbin]; - else value = c[sy]; + if (fft) { + if (m_binDisplay == PeakBins) { + if (!fft->isLocalPeak(sx, sy)) continue; + } + value = values[sy - minbin]; + } else { + if (m_binDisplay == PeakBins) { + if (sy == 0 || sy+1 >= c.size() || + c.at(sy) < c.at(sy-1) || + c.at(sy) < c.at(sy+1)) continue; + } + value = c.at(sy); + } if (m_colourScale != PhaseColourScale) { if (!m_normalizeColumns) {