| 457 | } |
| 458 | |
| 459 | int NoteStepSequencer::RowToPitch(int row) |
| 460 | { |
| 461 | row += mRowOffset; |
| 462 | |
| 463 | int numPitchesInScale = TheScale->NumTonesInScale(); |
| 464 | switch (mNoteMode) |
| 465 | { |
| 466 | case kNoteMode_Scale: |
| 467 | return TheScale->GetPitchFromTone(row + mOctave * numPitchesInScale + TheScale->GetScaleDegree()); |
| 468 | case kNoteMode_Chromatic: |
| 469 | return row + mOctave * TheScale->GetPitchesPerOctave(); |
| 470 | case kNoteMode_Pentatonic: |
| 471 | { |
| 472 | bool isMinor = TheScale->IsInScale(TheScale->ScaleRoot() + 3); |
| 473 | const int minorPentatonic[5] = { 0, 3, 5, 7, 10 }; |
| 474 | const int majorPentatonic[5] = { 0, 2, 4, 7, 9 }; |
| 475 | |
| 476 | if (isMinor) |
| 477 | return TheScale->ScaleRoot() + (row / 5 + mOctave) * TheScale->GetPitchesPerOctave() + minorPentatonic[row % 5]; |
| 478 | else |
| 479 | return TheScale->ScaleRoot() + (row / 5 + mOctave) * TheScale->GetPitchesPerOctave() + majorPentatonic[row % 5]; |
| 480 | } |
| 481 | case kNoteMode_Fifths: |
| 482 | { |
| 483 | int oct = (row / 2) * numPitchesInScale; |
| 484 | bool isFifth = row % 2 == 1; |
| 485 | int fifths = oct; |
| 486 | if (isFifth) |
| 487 | fifths += 4; |
| 488 | return TheScale->GetPitchFromTone(fifths + mOctave * numPitchesInScale + TheScale->GetScaleDegree()); |
| 489 | } |
| 490 | } |
| 491 | return row; |
| 492 | } |
| 493 | |
| 494 | int NoteStepSequencer::PitchToRow(int pitch) |
| 495 | { |
nothing calls this directly
no test coverage detected