]> code.delx.au - virtualtones/blobdiff - instrument.cpp
Few polish fixes
[virtualtones] / instrument.cpp
index f8d7083197b006457521345e8fa909d92e34e5fa..b4e729602f341f334b915bfd8d7cbbedb0f9a757 100644 (file)
@@ -92,16 +92,17 @@ bool Instrument::event(QEvent *e)
 
 QString Instrument::midi2string(int num)
 {
-       int i;
-       for(i = 9; num > 11; i--) {
+       int octave;
+       for(octave = 0; num >= 12; octave++) {
                num -= 12;
        }
-
-       return QString(midnotes[num] + " - Octave:" + QString::number(i - 6)); // Middle C is then "C - Octave: 3"
+       return QString(midnotes[num] + " - Octave: " + QString::number(octave - 6)); // Middle C is then "C - Octave: 3"
 }
 
 bool Instrument::checkSharp(int note)
 {
+       // This misnamed function checks to see if we are of the the following notes. Useful for string instruments
+       // These are the notes with only a half-tone gap between them
 //1    13      25      37      49      61      73      85      97      109     121
 //6    18      30      42      54      66      78      90      102     114     126
        if((note - 1) % 12 == 0 || note - 1 == 0)