comparison layer/PianoScale.cpp @ 904:e0f08e108064 cxx11

Move to using double rather than float for floating-point calculations (float only for storage); more build fixes
author Chris Cannam
date Mon, 09 Mar 2015 12:02:10 +0000
parents 8072264dc61f
children b66fb15de477
comparison
equal deleted inserted replaced
903:1757933ce5a7 904:e0f08e108064
25 25
26 void 26 void
27 PianoScale::paintPianoVertical(View *v, 27 PianoScale::paintPianoVertical(View *v,
28 QPainter &paint, 28 QPainter &paint,
29 QRect r, 29 QRect r,
30 float minf, 30 double minf,
31 float maxf) 31 double maxf)
32 { 32 {
33 int x0 = r.x(), y0 = r.y(), x1 = r.x() + r.width(), y1 = r.y() + r.height(); 33 int x0 = r.x(), y0 = r.y(), x1 = r.x() + r.width(), y1 = r.y() + r.height();
34 34
35 paint.drawLine(x0, y0, x0, y1); 35 paint.drawLine(x0, y0, x0, y1);
36 36
37 int py = y1, ppy = y1; 37 int py = y1, ppy = y1;
38 paint.setBrush(paint.pen().color()); 38 paint.setBrush(paint.pen().color());
39 39
40 for (int i = 0; i < 128; ++i) { 40 for (int i = 0; i < 128; ++i) {
41 41
42 float f = Pitch::getFrequencyForPitch(i); 42 double f = Pitch::getFrequencyForPitch(i);
43 int y = lrintf(v->getYForFrequency(f, minf, maxf, true)); 43 int y = lrintf(v->getYForFrequency(f, minf, maxf, true));
44 44
45 if (y < y0 - 2) break; 45 if (y < y0 - 2) break;
46 if (y > y1 + 2) { 46 if (y > y1 + 2) {
47 continue; 47 continue;