comparison layer/SpectrumLayer.cpp @ 1147:1badacff7ab2 3.0-integration

Introduce labels in RangeMapper and use them in AudioDial, though only for tooltip at present. Make use of this for spectrogram magic -81dB/-Inf threshold. Also introduce static strings for inf/pi and use where appropriate.
author Chris Cannam
date Fri, 05 Aug 2016 17:48:52 +0100
parents ee01a4062747
children ff97318e993c
comparison
equal deleted inserted replaced
1146:74f2706995b7 1147:1badacff7ab2
19 #include "view/View.h" 19 #include "view/View.h"
20 #include "base/AudioLevel.h" 20 #include "base/AudioLevel.h"
21 #include "base/Preferences.h" 21 #include "base/Preferences.h"
22 #include "base/RangeMapper.h" 22 #include "base/RangeMapper.h"
23 #include "base/Pitch.h" 23 #include "base/Pitch.h"
24 #include "base/Strings.h"
24 25
25 #include "ColourMapper.h" 26 #include "ColourMapper.h"
26 #include "PaintAssistant.h" 27 #include "PaintAssistant.h"
27 28
28 #include <QPainter> 29 #include <QPainter>
605 double mindb = AudioLevel::multiplier_to_dB(minvalue); 606 double mindb = AudioLevel::multiplier_to_dB(minvalue);
606 double maxdb = AudioLevel::multiplier_to_dB(maxvalue); 607 double maxdb = AudioLevel::multiplier_to_dB(maxvalue);
607 QString mindbstr; 608 QString mindbstr;
608 QString maxdbstr; 609 QString maxdbstr;
609 if (mindb == AudioLevel::DB_FLOOR) { 610 if (mindb == AudioLevel::DB_FLOOR) {
610 mindbstr = tr("-Inf"); 611 mindbstr = Strings::minus_infinity;
611 } else { 612 } else {
612 mindbstr = QString("%1").arg(lrint(mindb)); 613 mindbstr = QString("%1").arg(lrint(mindb));
613 } 614 }
614 if (maxdb == AudioLevel::DB_FLOOR) { 615 if (maxdb == AudioLevel::DB_FLOOR) {
615 maxdbstr = tr("-Inf"); 616 maxdbstr = Strings::minus_infinity;
616 } else { 617 } else {
617 maxdbstr = QString("%1").arg(lrint(maxdb)); 618 maxdbstr = QString("%1").arg(lrint(maxdb));
618 } 619 }
619 if (lrint(mindb) != lrint(maxdb)) { 620 if (lrint(mindb) != lrint(maxdb)) {
620 dbstr = tr("%1 - %2").arg(mindbstr).arg(maxdbstr); 621 dbstr = tr("%1 - %2").arg(mindbstr).arg(maxdbstr);