22 #include "base/Pitch.h" 33 int x0 = r.x(), y0 = r.y(), x1 = r.x() + r.width(), y1 = r.y() + r.height();
35 paint.drawLine(x0, y0, x0, y1);
37 int py = y1, ppy = y1;
38 paint.setBrush(paint.pen().color());
40 for (
int i = 0; i < 128; ++i) {
42 float f = Pitch::getFrequencyForPitch(i);
45 if (y < y0 - 2)
break;
54 QColor col = Qt::gray;
60 paint.fillRect(x0 + 1,
68 if (n == 1 || n == 3 || n == 6 || n == 8 || n == 10) {
70 paint.drawLine(x0 + 1, y, x1, y);
71 int rh = ((py - y) / 4) * 2;
73 paint.drawRect(x0 + 1, y - (py-y)/4, (x1 - x0) / 2, rh);
74 }
else if (n == 0 || n == 5) {
77 paint.drawLine(x0 + 1, (y + py) / 2, x1, (y + py) / 2);
void paintPianoVertical(View *v, QPainter &paint, QRect rect, float minf, float maxf)
float getYForFrequency(float frequency, float minFreq, float maxFreq, bool logarithmic) const
Return the pixel y-coordinate corresponding to a given frequency, if the frequency range is as specif...
View is the base class of widgets that display one or more overlaid views of data against a horizonta...