changeset 489:363157772fbd

* Restore peak bins mode in spectrogram
author Chris Cannam
date Thu, 05 Feb 2009 17:46:34 +0000
parents 5cd6f0d3f42d
children aa477ddcadb5
files layer/SpectrogramLayer.cpp
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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) {