| 350 | } |
| 351 | |
| 352 | int PitchFromNoteName(std::string noteName) |
| 353 | { |
| 354 | int octave = -2; |
| 355 | if (isdigit(noteName[noteName.length() - 1])) |
| 356 | { |
| 357 | octave = noteName[noteName.length() - 1] - '0'; |
| 358 | if (noteName[noteName.length() - 2] == '-') |
| 359 | octave *= -1; |
| 360 | if (octave < 0) |
| 361 | noteName = noteName.substr(0, noteName.length() - 2); |
| 362 | else |
| 363 | noteName = noteName.substr(0, noteName.length() - 1); |
| 364 | } |
| 365 | |
| 366 | int pitch; |
| 367 | for (pitch = 0; pitch < 12; ++pitch) |
| 368 | { |
| 369 | if (noteName == NoteName(pitch, false) || noteName == NoteName(pitch, true)) |
| 370 | break; |
| 371 | } |
| 372 | if (pitch == 12) |
| 373 | TheSynth->LogEvent("error finding pitch for note " + noteName, kLogEventType_Error); |
| 374 | return pitch + (octave + 2) * 12; |
| 375 | } |
| 376 | |
| 377 | float Interp(float a, float start, float end) |
| 378 | { |