comparison layer/PaintAssistant.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 dc6457ac4d07
comparison
equal deleted inserted replaced
1146:74f2706995b7 1147:1badacff7ab2
16 #include "PaintAssistant.h" 16 #include "PaintAssistant.h"
17 17
18 #include "LayerGeometryProvider.h" 18 #include "LayerGeometryProvider.h"
19 19
20 #include "base/AudioLevel.h" 20 #include "base/AudioLevel.h"
21 #include "base/Strings.h"
21 22
22 #include <QPaintDevice> 23 #include <QPaintDevice>
23 #include <QPainter> 24 #include <QPainter>
24 25
25 #include <iostream> 26 #include <iostream>
79 case MeterScale: // ... min, max 80 case MeterScale: // ... min, max
80 val = AudioLevel::dB_to_multiplier(meterdbs[i]); 81 val = AudioLevel::dB_to_multiplier(meterdbs[i]);
81 text = QString("%1").arg(meterdbs[i]); 82 text = QString("%1").arg(meterdbs[i]);
82 if (i == n) text = "0dB"; 83 if (i == n) text = "0dB";
83 if (i == 0) { 84 if (i == 0) {
84 text = "-Inf"; 85 text = Strings::minus_infinity;
85 val = 0.0; 86 val = 0.0;
86 } 87 }
87 break; 88 break;
88 89
89 case dBScale: // ... min, max 90 case dBScale: // ... min, max
90 val = AudioLevel::dB_to_multiplier(-(10*n) + i * 10); 91 val = AudioLevel::dB_to_multiplier(-(10*n) + i * 10);
91 text = QString("%1").arg(-(10*n) + i * 10); 92 text = QString("%1").arg(-(10*n) + i * 10);
92 if (i == n) text = "0dB"; 93 if (i == n) text = "0dB";
93 if (i == 0) { 94 if (i == 0) {
94 text = "-Inf"; 95 text = Strings::minus_infinity;
95 val = 0.0; 96 val = 0.0;
96 } 97 }
97 break; 98 break;
98 } 99 }
99 100