diff layer/SpectrogramLayer.cpp @ 167:53b9c7656798

* Use RangeMappers in various places in plugin parameters, layer properties, playback parameters &c
author Chris Cannam
date Mon, 16 Oct 2006 20:42:23 +0000
parents 48182241f594
children 86cee2b060c7
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp	Mon Oct 16 13:13:57 2006 +0000
+++ b/layer/SpectrogramLayer.cpp	Mon Oct 16 20:42:23 2006 +0000
@@ -21,6 +21,7 @@
 #include "base/Window.h"
 #include "base/Pitch.h"
 #include "base/Preferences.h"
+#include "base/RangeMapper.h"
 
 #include <QPainter>
 #include <QImage>
@@ -428,6 +429,18 @@
     return tr("<unknown>");
 }
 
+RangeMapper *
+SpectrogramLayer::getNewPropertyRangeMapper(const PropertyName &name) const
+{
+    if (name == "Gain") {
+        return new LinearRangeMapper(-50, 50, -25, 25, tr("dB"));
+    }
+    if (name == "Threshold") {
+        return new LinearRangeMapper(-50, 0, -50, 0, tr("dB"));
+    }
+    return 0;
+}
+
 void
 SpectrogramLayer::setProperty(const PropertyName &name, int value)
 {