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

A threshold fix
author Chris Cannam
date Tue, 02 Aug 2016 09:09:58 +0100
parents 9fb8dfd7ce4c
children 4e7ed3252d80
line wrap: on
line diff
--- a/layer/ColourScale.cpp	Mon Aug 01 16:25:06 2016 +0100
+++ b/layer/ColourScale.cpp	Tue Aug 02 09:09:58 2016 +0100
@@ -19,6 +19,9 @@
 #include "base/LogRange.h"
 
 #include <cmath>
+#include <iostream>
+
+using namespace std;
 
 int ColourScale::m_maxPixel = 255;
 
@@ -27,6 +30,8 @@
     m_mapper(m_params.colourMap, 1.f, double(m_maxPixel))
 {
     if (m_params.minValue >= m_params.maxValue) {
+        cerr << "ERROR: ColourScale::ColourScale: minValue = "
+             << m_params.minValue << ", maxValue = " << m_params.maxValue << endl;
 	throw std::logic_error("maxValue must be greater than minValue");
     }
 
@@ -56,6 +61,12 @@
     }
 
     if (m_mappedMin >= m_mappedMax) {
+        cerr << "ERROR: ColourScale::ColourScale: minValue = " << m_params.minValue
+             << ", maxValue = " << m_params.maxValue
+             << ", threshold = " << m_params.threshold
+             << ", scale = " << int(m_params.scale)
+             << " resulting in mapped minValue = " << m_mappedMin
+             << ", mapped maxValue = " << m_mappedMax << endl;
 	throw std::logic_error("maxValue must be greater than minValue [after mapping]");
     }
 }