| 32 | } |
| 33 | |
| 34 | unsigned int PitchIndex(const double dMIDInote) |
| 35 | { |
| 36 | // MIDI numbers can be negative. Round in the right direction. |
| 37 | double dRound = (dMIDInote < 0.0) ? -0.5 : 0.5; |
| 38 | int nPitchIndex = ((int)(dMIDInote + dRound) % 12); |
| 39 | |
| 40 | // Because of the modulo, we know we're within 12 of positive, if dMIDInote is negative. |
| 41 | if (nPitchIndex < 0) |
| 42 | nPitchIndex += 12; |
| 43 | |
| 44 | return nPitchIndex; |
| 45 | } |
| 46 | |
| 47 | int PitchOctave(const double dMIDInote) |
| 48 | { |
no outgoing calls
no test coverage detected