changeset 1105:ea5ae9dd10ba spectrogram-minor-refactor

Convert ColourScaleType into an enum class
author Chris Cannam
date Thu, 14 Jul 2016 16:52:16 +0100
parents 46cc4644206d
children 8abdefce36a6
files layer/Colour3DPlotLayer.cpp layer/Colour3DPlotLayer.h layer/Colour3DPlotRenderer.cpp layer/ColourScale.cpp layer/ColourScale.h layer/SpectrogramLayer.cpp layer/SpectrogramLayer.h
diffstat 7 files changed, 110 insertions(+), 110 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp	Thu Jul 14 16:12:05 2016 +0100
+++ b/layer/Colour3DPlotLayer.cpp	Thu Jul 14 16:52:16 2016 +0100
@@ -52,7 +52,7 @@
     m_peaksCache(0),
     m_cacheValidStart(0),
     m_cacheValidEnd(0),
-    m_colourScale(ColourScale::LinearColourScale),
+    m_colourScale(ColourScaleType::Linear),
     m_colourScaleSet(false),
     m_colourMap(0),
     m_gain(1.0),
@@ -84,29 +84,29 @@
     cacheInvalid(); //!!! dup with above?
 }
 
-ColourScale::Scale
+ColourScaleType
 Colour3DPlotLayer::convertToColourScale(int value)
 {
     switch (value) {
     default:
-    case 0: return ColourScale::LinearColourScale;
-    case 1: return ColourScale::LogColourScale;
-    case 2: return ColourScale::PlusMinusOneScale;
-    case 3: return ColourScale::AbsoluteScale;
+    case 0: return ColourScaleType::Linear;
+    case 1: return ColourScaleType::Log;
+    case 2: return ColourScaleType::PlusMinusOne;
+    case 3: return ColourScaleType::Absolute;
     }
 }
 
 int
-Colour3DPlotLayer::convertFromColourScale(ColourScale::Scale scale)
+Colour3DPlotLayer::convertFromColourScale(ColourScaleType scale)
 {
     switch (scale) {
-    case ColourScale::LinearColourScale: return 0;
-    case ColourScale::LogColourScale: return 1;
-    case ColourScale::PlusMinusOneScale: return 2;
-    case ColourScale::AbsoluteScale: return 3;
+    case ColourScaleType::Linear: return 0;
+    case ColourScaleType::Log: return 1;
+    case ColourScaleType::PlusMinusOne: return 2;
+    case ColourScaleType::Absolute: return 3;
 
-    case ColourScale::MeterColourScale:
-    case ColourScale::PhaseColourScale:
+    case ColourScaleType::Meter:
+    case ColourScaleType::Phase:
     default: return 0;
     }
 }
@@ -222,10 +222,10 @@
 void
 Colour3DPlotLayer::modelChanged()
 {
-    if (!m_colourScaleSet && m_colourScale == ColourScale::LinearColourScale) {
+    if (!m_colourScaleSet && m_colourScale == ColourScaleType::Linear) {
         if (m_model) {
             if (m_model->shouldUseLogValueScale()) {
-                setColourScale(ColourScale::LogColourScale);
+                setColourScale(ColourScaleType::Log);
             } else {
                 m_colourScaleSet = true;
             }
@@ -237,10 +237,10 @@
 void
 Colour3DPlotLayer::modelChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame)
 {
-    if (!m_colourScaleSet && m_colourScale == ColourScale::LinearColourScale) {
+    if (!m_colourScaleSet && m_colourScale == ColourScaleType::Linear) {
         if (m_model && m_model->getWidth() > 50) {
             if (m_model->shouldUseLogValueScale()) {
-                setColourScale(ColourScale::LogColourScale);
+                setColourScale(ColourScaleType::Log);
             } else {
                 m_colourScaleSet = true;
             }
@@ -472,7 +472,7 @@
 }
 
 void
-Colour3DPlotLayer::setColourScale(ColourScale::Scale scale)
+Colour3DPlotLayer::setColourScale(ColourScaleType scale)
 {
     if (m_colourScale == scale) return;
     m_colourScale = scale;
@@ -882,12 +882,12 @@
         double mmin = min;
         double mmax = max;
 
-        if (m_colourScale == ColourScale::LogColourScale) {
+        if (m_colourScale == ColourScaleType::Log) {
             LogRange::mapRange(mmin, mmax);
-        } else if (m_colourScale == ColourScale::PlusMinusOneScale) {
+        } else if (m_colourScale == ColourScaleType::PlusMinusOne) {
             mmin = -1.f;
             mmax = 1.f;
-        } else if (m_colourScale == ColourScale::AbsoluteScale) {
+        } else if (m_colourScale == ColourScaleType::Absolute) {
             if (mmin < 0) {
                 if (fabs(mmin) > fabs(mmax)) mmax = fabs(mmin);
                 else mmax = fabs(mmax);
@@ -906,7 +906,7 @@
 
         for (int y = 0; y < ch; ++y) {
             double value = ((max - min) * (double(ch-y) - 1.0)) / double(ch) + min;
-            if (m_colourScale == ColourScale::LogColourScale) {
+            if (m_colourScale == ColourScaleType::Log) {
                 value = LogRange::map(value);
             }
             int pixel = int(((value - mmin) * 256) / (mmax - mmin));
@@ -1183,12 +1183,12 @@
     double min = m_model->getMinimumLevel();
     double max = m_model->getMaximumLevel();
 
-    if (m_colourScale == ColourScale::LogColourScale) {
+    if (m_colourScale == ColourScaleType::Log) {
         LogRange::mapRange(min, max);
-    } else if (m_colourScale == ColourScale::PlusMinusOneScale) {
+    } else if (m_colourScale == ColourScaleType::PlusMinusOne) {
         min = -1.f;
         max = 1.f;
-    } else if (m_colourScale == ColourScale::AbsoluteScale) {
+    } else if (m_colourScale == ColourScaleType::Absolute) {
         if (min < 0) {
             if (fabs(min) > fabs(max)) max = fabs(min);
             else max = fabs(max);
@@ -1233,11 +1233,11 @@
             if (c == fillStart || colMin < visibleMin) visibleMin = colMin;
         }
 
-        if (m_colourScale == ColourScale::LogColourScale) {
+        if (m_colourScale == ColourScaleType::Log) {
             visibleMin = LogRange::map(visibleMin);
             visibleMax = LogRange::map(visibleMax);
             if (visibleMin > visibleMax) std::swap(visibleMin, visibleMax);
-        } else if (m_colourScale == ColourScale::AbsoluteScale) {
+        } else if (m_colourScale == ColourScaleType::Absolute) {
             if (visibleMin < 0) {
                 if (fabs(visibleMin) > fabs(visibleMax)) visibleMax = fabs(visibleMin);
                 else visibleMax = fabs(visibleMax);
@@ -1280,9 +1280,9 @@
 
             value = value * m_gain;
 
-            if (m_colourScale == ColourScale::LogColourScale) {
+            if (m_colourScale == ColourScaleType::Log) {
                 value = LogRange::map(value);
-            } else if (m_colourScale == ColourScale::AbsoluteScale) {
+            } else if (m_colourScale == ColourScaleType::Absolute) {
                 value = fabs(value);
             }
             
@@ -1906,7 +1906,7 @@
 {
     bool ok = false, alsoOk = false;
 
-    ColourScale::Scale colourScale = convertToColourScale
+    ColourScaleType colourScale = convertToColourScale
         (attributes.value("colourScale").toInt(&ok));
     if (ok) setColourScale(colourScale);
 
--- a/layer/Colour3DPlotLayer.h	Thu Jul 14 16:12:05 2016 +0100
+++ b/layer/Colour3DPlotLayer.h	Thu Jul 14 16:52:16 2016 +0100
@@ -90,8 +90,8 @@
     virtual void setProperty(const PropertyName &, int value);
     virtual void setProperties(const QXmlAttributes &);
     
-    void setColourScale(ColourScale::Scale);
-    ColourScale::Scale getColourScale() const { return m_colourScale; }
+    void setColourScale(ColourScaleType);
+    ColourScaleType getColourScale() const { return m_colourScale; }
 
     void setColourMap(int map);
     int getColourMap() const;
@@ -163,7 +163,7 @@
     mutable int m_cacheValidStart;
     mutable int m_cacheValidEnd;
 
-    ColourScale::Scale m_colourScale;
+    ColourScaleType m_colourScale;
     bool m_colourScaleSet;
     int m_colourMap;
     float m_gain;
@@ -182,8 +182,8 @@
 
     bool m_synchronous;
 
-    static ColourScale::Scale convertToColourScale(int value);
-    static int convertFromColourScale(ColourScale::Scale);
+    static ColourScaleType convertToColourScale(int value);
+    static int convertFromColourScale(ColourScaleType);
     static std::pair<ColumnNormalization, bool> convertToColumnNorm(int value);
     static int convertFromColumnNorm(ColumnNormalization norm, bool visible);
 
--- a/layer/Colour3DPlotRenderer.cpp	Thu Jul 14 16:12:05 2016 +0100
+++ b/layer/Colour3DPlotRenderer.cpp	Thu Jul 14 16:52:16 2016 +0100
@@ -263,7 +263,7 @@
         usePeaksCache = (binResolution * binsPerPeak) < zoomLevel;
         
         if (m_params.colourScale.getScale() ==
-            ColourScale::PhaseColourScale) {
+            ColourScaleType::Phase) {
             usePeaksCache = false;
         }
     }
@@ -534,7 +534,7 @@
                     vector<float>(fullColumn.data() + minbin,
                                   fullColumn.data() + maxbin + 1);
 
-//!!! fft scale                if (m_colourScale != PhaseColourScale) {
+//!!! fft scale                if (m_colourScale != ColourScaleType::Phase) {
 //                    column = ColumnOp::fftScale(column, m_fftSize);
 //                }
 
@@ -543,7 +543,7 @@
 //                                    overallMag,
 //                                    overallMagChanged);
 
-//                if (m_colourScale != PhaseColourScale) {
+//                if (m_colourScale != ColourScaleType::Phase) {
                     column = ColumnOp::normalize(column, m_params.normalization);
 //                }
 
@@ -670,7 +670,7 @@
                     vector<float>(fullColumn.data() + minbin,
                                   fullColumn.data() + maxbin + 1);
 
-//!!! fft scale                if (m_colourScale != ColourScale::PhaseColourScale) {
+//!!! fft scale                if (m_colourScale != ColourScaleType::Phase) {
 //                    column = ColumnOp::fftScale(column, getFFTSize());
 //                }
 
@@ -679,7 +679,7 @@
 //                                    overallMag,
 //                                    overallMagChanged);
 
-//!!!                if (m_colourScale != ColourScale::PhaseColourScale) {
+//!!!                if (m_colourScale != ColourScaleType::Phase) {
                     column = ColumnOp::normalize(column, m_params.normalization);
 //!!!                }
 
--- a/layer/ColourScale.cpp	Thu Jul 14 16:12:05 2016 +0100
+++ b/layer/ColourScale.cpp	Thu Jul 14 16:52:16 2016 +0100
@@ -33,16 +33,16 @@
     m_mappedMin = m_params.minValue;
     m_mappedMax = m_params.maxValue;
 
-    if (m_params.scale == LogColourScale) {
+    if (m_params.scale == ColourScaleType::Log) {
 
 	LogRange::mapRange(m_mappedMin, m_mappedMax);
 	
-    } else if (m_params.scale == PlusMinusOneScale) {
+    } else if (m_params.scale == ColourScaleType::PlusMinusOne) {
 	
 	m_mappedMin = -1.0;
 	m_mappedMax =  1.0;
 
-    } else if (m_params.scale == AbsoluteScale) {
+    } else if (m_params.scale == ColourScaleType::Absolute) {
 
 	m_mappedMin = fabs(m_mappedMin);
 	m_mappedMax = fabs(m_mappedMax);
@@ -60,7 +60,7 @@
 {
 }
 
-ColourScale::Scale
+ColourScaleType
 ColourScale::getScale() const
 {
     return m_params.scale;
@@ -71,7 +71,7 @@
 {
     double maxPixF = m_maxPixel;
 
-    if (m_params.scale == PhaseColourScale) {
+    if (m_params.scale == ColourScaleType::Phase) {
 	double half = (maxPixF - 1.f) / 2.f;
 	return 1 + int((value * half) / M_PI + half);
     }
@@ -82,12 +82,12 @@
 
     double mapped = value;
 
-    if (m_params.scale == LogColourScale) {
+    if (m_params.scale == ColourScaleType::Log) {
 	mapped = LogRange::map(value);
-    } else if (m_params.scale == PlusMinusOneScale) {
+    } else if (m_params.scale == ColourScaleType::PlusMinusOne) {
 	if (mapped < -1.f) mapped = -1.f;
 	if (mapped > 1.f) mapped = 1.f;
-    } else if (m_params.scale == AbsoluteScale) {
+    } else if (m_params.scale == ColourScaleType::Absolute) {
 	if (mapped < 0.f) mapped = -mapped;
     }
 	
@@ -102,7 +102,7 @@
 
     int pixel = 0;
 
-    if (m_params.scale == MeterColourScale) {
+    if (m_params.scale == ColourScaleType::Meter) {
 	pixel = AudioLevel::multiplier_to_preview(proportion, m_maxPixel-1) + 1;
     } else {
 	pixel = int(proportion * maxPixF) + 1;
--- a/layer/ColourScale.h	Thu Jul 14 16:12:05 2016 +0100
+++ b/layer/ColourScale.h	Thu Jul 14 16:52:16 2016 +0100
@@ -18,6 +18,15 @@
 
 #include "ColourMapper.h"
 
+enum class ColourScaleType {
+    Linear,
+    Meter,
+    Log,
+    Phase,
+    PlusMinusOne,
+    Absolute
+};
+
 /**
  * Map values within a range onto a set of colours, with a given
  * distribution (linear, log etc) and optional colourmap rotation.
@@ -25,17 +34,8 @@
 class ColourScale
 {
 public:
-    enum Scale {
-	LinearColourScale,
-	MeterColourScale,
-	LogColourScale,
-	PhaseColourScale,
-        PlusMinusOneScale,
-        AbsoluteScale
-    };
-
     struct Parameters {
-	Parameters() : colourMap(0), scale(LinearColourScale),
+	Parameters() : colourMap(0), scale(ColourScaleType::Linear),
 		       minValue(0.0), maxValue(1.0),
 		       threshold(0.0), gain(1.0) { }
 
@@ -43,7 +43,7 @@
 	int colourMap;
 	
 	/** Distribution for the scale */
-	Scale scale;
+	ColourScaleType scale;
 	
 	/** Minimum value in source range */
 	double minValue;
@@ -76,7 +76,7 @@
     /**
      * Return the general type of scale this is.
      */
-    Scale getScale() const;
+    ColourScaleType getScale() const;
     
     /**
      * Return a pixel number (in the range 0-255 inclusive)
--- a/layer/SpectrogramLayer.cpp	Thu Jul 14 16:12:05 2016 +0100
+++ b/layer/SpectrogramLayer.cpp	Thu Jul 14 16:52:16 2016 +0100
@@ -72,7 +72,7 @@
     m_minFrequency(10),
     m_maxFrequency(8000),
     m_initialMaxFrequency(8000),
-    m_colourScale(ColourScale::LogColourScale),
+    m_colourScale(ColourScaleType::Log),
     m_colourMap(0),
     m_binScale(BinScale::Linear),
     m_binDisplay(BinDisplay::AllBins),
@@ -98,7 +98,7 @@
         m_initialMaxFrequency = 1500;
 	setMaxFrequency(1500);
         setMinFrequency(40);
-	setColourScale(ColourScale::LinearColourScale);
+	setColourScale(ColourScaleType::Linear);
         setColourMap(ColourMapper::Sunset);
         setBinScale(BinScale::Log);
         colourConfigName = "spectrogram-melodic-colour";
@@ -111,7 +111,7 @@
 	setMaxFrequency(2000);
 	setMinFrequency(40);
 	setBinScale(BinScale::Log);
-	setColourScale(ColourScale::LinearColourScale);
+	setColourScale(ColourScaleType::Linear);
 	setBinDisplay(BinDisplay::PeakFrequencies);
         setNormalization(ColumnNormalization::Max1);
         colourConfigName = "spectrogram-melodic-colour";
@@ -137,30 +137,30 @@
     invalidateFFTModel();
 }
 
-ColourScale::Scale
+ColourScaleType
 SpectrogramLayer::convertToColourScale(int value)
 {
     switch (value) {
-    case 0: return ColourScale::LinearColourScale;
-    case 1: return ColourScale::MeterColourScale;
-    case 2: return ColourScale::LogColourScale; //!!! db^2
-    case 3: return ColourScale::LogColourScale;
-    case 4: return ColourScale::PhaseColourScale;
-    default: return ColourScale::LinearColourScale;
+    case 0: return ColourScaleType::Linear;
+    case 1: return ColourScaleType::Meter;
+    case 2: return ColourScaleType::Log; //!!! db^2
+    case 3: return ColourScaleType::Log;
+    case 4: return ColourScaleType::Phase;
+    default: return ColourScaleType::Linear;
     }
 }
 
 int
-SpectrogramLayer::convertFromColourScale(ColourScale::Scale scale)
+SpectrogramLayer::convertFromColourScale(ColourScaleType scale)
 {
     switch (scale) {
-    case ColourScale::LinearColourScale: return 0;
-    case ColourScale::MeterColourScale: return 1;
-    case ColourScale::LogColourScale: return 3; //!!! + db^2
-    case ColourScale::PhaseColourScale: return 4;
-
-    case ColourScale::PlusMinusOneScale:
-    case ColourScale::AbsoluteScale:
+    case ColourScaleType::Linear: return 0;
+    case ColourScaleType::Meter: return 1;
+    case ColourScaleType::Log: return 3; //!!! + db^2
+    case ColourScaleType::Phase: return 4;
+
+    case ColourScaleType::PlusMinusOne:
+    case ColourScaleType::Absolute:
     default: return 0;
     }
 }
@@ -594,11 +594,11 @@
     } else if (name == "Colour Scale") {
 	switch (value) {
 	default:
-	case 0: setColourScale(ColourScale::LinearColourScale); break;
-	case 1: setColourScale(ColourScale::MeterColourScale); break;
-	case 2: setColourScale(ColourScale::LogColourScale); break; //!!! dB^2
-	case 3: setColourScale(ColourScale::LogColourScale); break;
-	case 4: setColourScale(ColourScale::PhaseColourScale); break;
+	case 0: setColourScale(ColourScaleType::Linear); break;
+	case 1: setColourScale(ColourScaleType::Meter); break;
+	case 2: setColourScale(ColourScaleType::Log); break; //!!! dB^2
+	case 3: setColourScale(ColourScaleType::Log); break;
+	case 4: setColourScale(ColourScaleType::Phase); break;
 	}
     } else if (name == "Frequency Scale") {
 	switch (value) {
@@ -867,7 +867,7 @@
 }
 
 void
-SpectrogramLayer::setColourScale(ColourScale::Scale colourScale)
+SpectrogramLayer::setColourScale(ColourScaleType colourScale)
 {
     if (m_colourScale == colourScale) return;
 
@@ -878,7 +878,7 @@
     emit layerParametersChanged();
 }
 
-ColourScale::Scale
+ColourScaleType
 SpectrogramLayer::getColourScale() const
 {
     return m_colourScale;
@@ -1104,8 +1104,8 @@
         min = m_viewMags[v->getId()].getMin();
         max = m_viewMags[v->getId()].getMax();
     } else if (m_normalization != ColumnNormalization::Max1) {
-        if (m_colourScale == ColourScale::LinearColourScale //||
-//            m_colourScale == MeterColourScale) {
+        if (m_colourScale == ColourScaleType::Linear //||
+//            m_colourScale == ColourScaleType::Meter) {
             ) {
             max = 0.1;
         }
@@ -1118,11 +1118,11 @@
 
     switch (m_colourScale) {
 	
-    case ColourScale::LinearColourScale:
+    case ColourScaleType::Linear:
         value = int(((input - min) / (max - min)) * 255.0) + 1;
 	break;
 	
-    case ColourScale::MeterColourScale:
+    case ColourScaleType::Meter:
         value = AudioLevel::multiplier_to_preview
             ((input - min) / (max - min), 254) + 1;
 	break;
@@ -1145,7 +1145,7 @@
 	value = int(input * 255.0) + 1;
 	break;
 */	
-    case ColourScale::LogColourScale:
+    case ColourScaleType::Log:
         //!!! experiment with normalizing the visible area this way.
         //In any case, we need to have some indication of what the dB
         //scale is relative to.
@@ -1165,12 +1165,12 @@
 	value = int(input * 255.0) + 1;
 	break;
 	
-    case ColourScale::PhaseColourScale:
+    case ColourScaleType::Phase:
 	value = int((input * 127.0 / M_PI) + 128);
 	break;
 
-    case ColourScale::PlusMinusOneScale:
-    case ColourScale::AbsoluteScale:
+    case ColourScaleType::PlusMinusOne:
+    case ColourScaleType::Absolute:
     default:
         ;
     }
@@ -1656,7 +1656,7 @@
         cparams.threshold = m_threshold;
         cparams.gain = m_gain;
 
-        if (m_colourScale != ColourScale::PhaseColourScale &&
+        if (m_colourScale != ColourScaleType::Phase &&
             m_normalization == ColumnNormalization::None) {
             cparams.gain *= 2.f / float(getFFTSize());
         }
@@ -1983,7 +1983,7 @@
             m_drawBuffer = QImage(bufwid, h, QImage::Format_Indexed8);
         }
         usePeaksCache = (increment * m_peakCacheDivisor) < zoomLevel;
-        if (m_colourScale == ColourScale::PhaseColourScale) usePeaksCache = false;
+        if (m_colourScale == ColourScaleType::Phase) usePeaksCache = false;
     }
 
     for (int pixel = 0; pixel < 256; ++pixel) {
@@ -2313,7 +2313,7 @@
                                                minbin,
                                                maxbin - minbin + 1);
 
-                if (m_colourScale != ColourScale::PhaseColourScale) {
+                if (m_colourScale != ColourScaleType::Phase) {
                     column = ColumnOp::fftScale(column, getFFTSize());
                 }
 
@@ -2322,7 +2322,7 @@
                                     overallMag,
                                     overallMagChanged);
 
-                if (m_colourScale != ColourScale::PhaseColourScale) {
+                if (m_colourScale != ColourScaleType::Phase) {
                     column = ColumnOp::normalize(column, m_normalization);
                 }
 
@@ -2405,7 +2405,7 @@
 {
     vector<float> values(bincount, 0.f);
     
-    if (m_colourScale == ColourScale::PhaseColourScale) {
+    if (m_colourScale == ColourScaleType::Phase) {
         fft->getPhasesAt(sx, values.data(), minbin, bincount);
     } else {
         fft->getMagnitudesAt(sx, values.data(), minbin, bincount);
@@ -2420,7 +2420,7 @@
                                             int minbin,
                                             int bincount) const
 {
-    if (m_colourScale == ColourScale::PhaseColourScale) {
+    if (m_colourScale == ColourScaleType::Phase) {
         throw std::logic_error("can't use phase scale with generic 3d model");
     }
 
@@ -2574,7 +2574,7 @@
                                                    maxbin - minbin + 1);
                 }
 
-                if (m_colourScale != ColourScale::PhaseColourScale) {
+                if (m_colourScale != ColourScaleType::Phase) {
                     column = ColumnOp::fftScale(column, getFFTSize());
                 }
 
@@ -2583,7 +2583,7 @@
                                     overallMag,
                                     overallMagChanged);
 
-                if (m_colourScale != ColourScale::PhaseColourScale) {
+                if (m_colourScale != ColourScaleType::Phase) {
                     column = ColumnOp::normalize(column, m_normalization);
                 }
 
@@ -3132,7 +3132,7 @@
     if (detailed && (h > textHeight * 3 + 10)) {
 
         int topLines = 2;
-        if (m_colourScale == ColourScale::PhaseColourScale) topLines = 1;
+        if (m_colourScale == ColourScaleType::Phase) topLines = 1;
 
 	int ch = h - textHeight * (topLines + 1) - 8;
 //	paint.drawRect(4, textHeight + 4, cw - 1, ch + 1);
@@ -3159,7 +3159,7 @@
 
         //!!! & phase etc
 
-        if (m_colourScale != ColourScale::PhaseColourScale) {
+        if (m_colourScale != ColourScaleType::Phase) {
             paint.drawText((cw + 6 - paint.fontMetrics().width("dBFS")) / 2,
                            2 + textHeight + toff, "dBFS");
         }
@@ -3561,7 +3561,7 @@
         setMaxFrequency(maxFrequency);
     }
 
-    ColourScale::Scale colourScale = convertToColourScale
+    ColourScaleType colourScale = convertToColourScale
         (attributes.value("colourScale").toInt(&ok));
     if (ok) setColourScale(colourScale);
 
--- a/layer/SpectrogramLayer.h	Thu Jul 14 16:12:05 2016 +0100
+++ b/layer/SpectrogramLayer.h	Thu Jul 14 16:52:16 2016 +0100
@@ -143,8 +143,8 @@
      * WaveformLayer for comparison and details of meter and dB
      * scaling.  The default is LogColourScale.
      */
-    void setColourScale(ColourScale::Scale);
-    ColourScale::Scale getColourScale() const;
+    void setColourScale(ColourScaleType);
+    ColourScaleType getColourScale() const;
 
     /**
      * Specify the scale for the y axis.
@@ -250,7 +250,7 @@
     int                 m_minFrequency;
     int                 m_maxFrequency;
     int                 m_initialMaxFrequency;
-    ColourScale::Scale  m_colourScale;
+    ColourScaleType  m_colourScale;
     int                 m_colourMap;
     QColor              m_crosshairColour;
     BinScale            m_binScale;
@@ -262,8 +262,8 @@
 
     mutable bool        m_haveDetailedScale;
 
-    static ColourScale::Scale convertToColourScale(int value);
-    static int convertFromColourScale(ColourScale::Scale);
+    static ColourScaleType convertToColourScale(int value);
+    static int convertFromColourScale(ColourScaleType);
     static std::pair<ColumnNormalization, bool> convertToColumnNorm(int value);
     static int convertFromColumnNorm(ColumnNormalization norm, bool visible);