comparison 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
comparison
equal deleted inserted replaced
166:48182241f594 167:53b9c7656798
19 #include "base/Profiler.h" 19 #include "base/Profiler.h"
20 #include "base/AudioLevel.h" 20 #include "base/AudioLevel.h"
21 #include "base/Window.h" 21 #include "base/Window.h"
22 #include "base/Pitch.h" 22 #include "base/Pitch.h"
23 #include "base/Preferences.h" 23 #include "base/Preferences.h"
24 #include "base/RangeMapper.h"
24 25
25 #include <QPainter> 26 #include <QPainter>
26 #include <QImage> 27 #include <QImage>
27 #include <QPixmap> 28 #include <QPixmap>
28 #include <QRect> 29 #include <QRect>
424 case 1: return tr("Peak Bins"); 425 case 1: return tr("Peak Bins");
425 case 2: return tr("Frequencies"); 426 case 2: return tr("Frequencies");
426 } 427 }
427 } 428 }
428 return tr("<unknown>"); 429 return tr("<unknown>");
430 }
431
432 RangeMapper *
433 SpectrogramLayer::getNewPropertyRangeMapper(const PropertyName &name) const
434 {
435 if (name == "Gain") {
436 return new LinearRangeMapper(-50, 50, -25, 25, tr("dB"));
437 }
438 if (name == "Threshold") {
439 return new LinearRangeMapper(-50, 0, -50, 0, tr("dB"));
440 }
441 return 0;
429 } 442 }
430 443
431 void 444 void
432 SpectrogramLayer::setProperty(const PropertyName &name, int value) 445 SpectrogramLayer::setProperty(const PropertyName &name, int value)
433 { 446 {