diff layer/PaintAssistant.cpp @ 946:36cddc3de023 alignment_view

Merge from default branch
author Chris Cannam
date Mon, 20 Apr 2015 09:19:52 +0100
parents b66fb15de477
children ee01a4062747
line wrap: on
line diff
--- a/layer/PaintAssistant.cpp	Thu Jan 15 16:00:53 2015 +0000
+++ b/layer/PaintAssistant.cpp	Mon Apr 20 09:19:52 2015 +0100
@@ -25,11 +25,11 @@
 
 void
 PaintAssistant::paintVerticalLevelScale(QPainter &paint, QRect rect,
-					float minVal, float maxVal,
+					double minVal, double maxVal,
                                         Scale scale, int &mult,
                                         std::vector<int> *vy)
 {
-    static float meterdbs[] = { -40, -30, -20, -15, -10,
+    static double meterdbs[] = { -40, -30, -20, -15, -10,
                                 -5, -3, -2, -1, -0.5, 0 };
 
     int h = rect.height(), w = rect.width();
@@ -41,7 +41,7 @@
     int n = 10;
     if (vy) vy->clear();
 
-    float step = 0;
+    double step = 0;
     mult = 1;
     if (scale == LinearScale) {
         step = (maxVal - minVal) / n;
@@ -53,8 +53,8 @@
         if (round) {
             mult /= 10;
 //            cerr << "\n\nstep goes from " << step;
-            step = float(round) / mult;
-            n = lrintf((maxVal - minVal) / step);
+            step = double(round) / mult;
+            n = int(lrint((maxVal - minVal) / step));
             if (mult > 1) {
                 mult /= 10;
             }
@@ -64,7 +64,7 @@
 
     for (int i = 0; i <= n; ++i) {
         
-        float val = 0.0, nval = 0.0;
+        double val = 0.0, nval = 0.0;
         QString text = "";
 
         switch (scale) {
@@ -166,20 +166,20 @@
 }
 
 static int
-dBscale(float sample, int m, float maxVal, float minVal) 
+dBscale(double sample, int m, double maxVal, double minVal) 
 {
     if (sample < 0.0) return dBscale(-sample, m, maxVal, minVal);
-    float dB = AudioLevel::multiplier_to_dB(sample);
-    float mindB = AudioLevel::multiplier_to_dB(minVal);
-    float maxdB = AudioLevel::multiplier_to_dB(maxVal);
+    double dB = AudioLevel::multiplier_to_dB(sample);
+    double mindB = AudioLevel::multiplier_to_dB(minVal);
+    double maxdB = AudioLevel::multiplier_to_dB(maxVal);
     if (dB < mindB) return 0;
     if (dB > 0.0) return m;
     return int(((dB - mindB) * m) / (maxdB - mindB) + 0.1);
 }
 
 int
-PaintAssistant::getYForValue(Scale scale, float value, 
-                             float minVal, float maxVal,
+PaintAssistant::getYForValue(Scale scale, double value, 
+                             double minVal, double maxVal,
                              int minY, int height)
 {
     int vy = 0;