diff layer/SpectrumLayer.cpp @ 1399:ba1f0234efa7

Fixes to spectrum axis calculations, + default to starting at bin 1
author Chris Cannam
date Wed, 14 Nov 2018 15:47:21 +0000
parents f228bee4981c
children decb7741d036
line wrap: on
line diff
--- a/layer/SpectrumLayer.cpp	Wed Nov 14 15:14:21 2018 +0000
+++ b/layer/SpectrumLayer.cpp	Wed Nov 14 15:47:21 2018 +0000
@@ -122,6 +122,11 @@
                                     getWindowIncrement(),
                                     fftSize);
 
+    if (m_minbin == 0 && m_maxbin == 0) {
+        m_minbin = 1;
+        m_maxbin = newFFT->getHeight();
+    }
+    
     setSliceableModel(newFFT);
 
     m_biasCurve.clear();
@@ -433,6 +438,7 @@
     if (!m_sliceableModel) return 0;
 
     double fmin = getFrequencyForBin(m_minbin);
+
     if (m_binScale == LogBins && m_minbin == 0) {
         // See comment in getFrequencyForX above
         fmin = getFrequencyForBin(0.8);
@@ -440,8 +446,8 @@
     }
     
     double fmax = getFrequencyForBin(m_maxbin);
-
     double x = getXForScalePoint(v, freq, fmin, fmax);
+    
     return x;
 }