X-Git-Url: https://code.delx.au/virtualtones/blobdiff_plain/a132d76b55c3c8f89ad79e7a70d9983ad12021fc..e0efeea407809897396731f760ff60e361351d83:/instrument.cpp diff --git a/instrument.cpp b/instrument.cpp index f8d7083..b4e7296 100644 --- a/instrument.cpp +++ b/instrument.cpp @@ -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)