diff layer/SpectrogramLayer.cpp @ 1129:371320c9f8d9 spectrogram-minor-refactor

A threshold fix
author Chris Cannam
date Tue, 02 Aug 2016 09:09:58 +0100
parents 4e022a3e567b
children ee98d587cd1a
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp	Mon Aug 01 16:25:06 2016 +0100
+++ b/layer/SpectrogramLayer.cpp	Tue Aug 02 09:09:58 2016 +0100
@@ -1456,15 +1456,21 @@
         ColourScale::Parameters cparams;
         cparams.colourMap = m_colourMap;
         cparams.scale = m_colourScale;
-        cparams.threshold = m_threshold;
-        cparams.gain = m_gain;
+
+        if (m_colourScale != ColourScaleType::Phase) {
+            cparams.gain = m_gain;
+            cparams.threshold = m_threshold;
+        }
 
         if (m_colourScale == ColourScaleType::Linear &&
             m_normalization == ColumnNormalization::None) {
             //!!! This should not be necessary -- what is the actual range
             cparams.maxValue = 0.1;
+            if (cparams.maxValue <= m_threshold) {
+                cparams.maxValue = m_threshold + 0.1;
+            }
         }
-        
+
         Colour3DPlotRenderer::Parameters params;
         params.colourScale = ColourScale(cparams);
         params.normalization = m_normalization;
@@ -1475,8 +1481,7 @@
         params.scaleFactor = 1.0;
         params.colourRotation = m_colourRotation;
 
-        if (m_colourScale != ColourScaleType::Phase &&
-            m_normalization == ColumnNormalization::None) {
+        if (m_colourScale != ColourScaleType::Phase) {
             params.scaleFactor *= 2.f / float(getFFTSize());
         }
 
@@ -2103,9 +2108,7 @@
             double dBval = dBmin + (((dBmax - dBmin) * i) / (ch - 1));
             int idb = int(dBval);
 
-            //!!!
             double value = AudioLevel::dB_to_multiplier(dBval);
-            cerr << "dBval = " << dBval << ", value = " << value << endl;
             paint.setPen(getRenderer(v)->getColour(value));
 
             int y = textHeight * topLines + 4 + ch - i;