Fixed octave display
authorJames Bunton <jamesbunton@delx.net.au>
Mon, 13 Mar 2017 01:47:06 +0000 (12:47 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Mon, 13 Mar 2017 01:48:35 +0000 (12:48 +1100)
instrument.cpp
stringinstrument.cpp

index 9a3b7c4..546100e 100644 (file)
@@ -98,7 +98,7 @@ QString Instrument::midi2string(int num)
        for(octave = 0; num >= 12; octave++) {
                num -= 12;
        }
-       return QString(midnotes[num] + " - Octave: " + QString::number(octave - 6)); // Middle C is then "C - Octave: 3"
+       return QString(midnotes[num] + " - Octave: " + QString::number(octave - 2)); // Middle C is then "C - Octave: 3"
 }
 
 bool Instrument::checkSharp(int note)
index 9d0a9f9..b37d809 100644 (file)
@@ -174,7 +174,7 @@ void StringInstrument::paintEvent(QPaintEvent *) {
        for(int i = 0; i < 4; i++) {
                QString text;
                text += "Playing note: ";
-               text += midi2string(note[i]);
+               text += midi2string(noteStart + note[i]);
                text += " - Volume: " + QString::number(volume[i] / 30);
                paint.drawText(45, (i+1)*20, text);
        }