@@ -666,91 +666,6 @@ int searchInterval(int steps, int semitones)
666
666
return -1 ;
667
667
}
668
668
669
- // ---------------------------------------------------------
670
- // diatonicUpDown
671
- // used to find the second note of a trill, mordent etc.
672
- // key -7 ... +7
673
- // ---------------------------------------------------------
674
-
675
- int diatonicUpDown (Key k, int pitch, int steps)
676
- {
677
- static int ptab[15 ][7 ] = {
678
- // c c# d d# e f f# g g# a a# b
679
- { -1 , 1 , 3 , 4 , 6 , 8 , 10 }, // Cb Ces
680
- { -1 , 1 , 3 , 5 , 6 , 8 , 10 }, // Gb Ges
681
- { 0 , 1 , 3 , 5 , 6 , 8 , 10 }, // Db Des
682
- { 0 , 1 , 3 , 5 , 7 , 8 , 10 }, // Ab As
683
- { 0 , 2 , 3 , 5 , 7 , 8 , 10 }, // Eb Es
684
- { 0 , 2 , 3 , 5 , 7 , 9 , 10 }, // Bb B
685
- { 0 , 2 , 4 , 5 , 7 , 9 , 10 }, // F F
686
-
687
- { 0 , 2 , 4 , 5 , 7 , 9 , 11 }, // C C
688
-
689
- { 0 , 2 , 4 , 6 , 7 , 9 , 11 }, // G G
690
- { 1 , 2 , 4 , 6 , 7 , 9 , 11 }, // D D
691
- { 1 , 2 , 4 , 6 , 8 , 9 , 11 }, // A A
692
- { 1 , 3 , 4 , 6 , 8 , 9 , 11 }, // E E
693
- { 1 , 3 , 4 , 6 , 8 , 10 , 11 }, // B H
694
- { 1 , 3 , 5 , 6 , 8 , 10 , 11 }, // F# Fis
695
- { 1 , 3 , 5 , 6 , 8 , 10 , 12 }, // C# Cis
696
- };
697
-
698
- int key = int (k) + 7 ;
699
- int step = pitch % PITCH_DELTA_OCTAVE;
700
- int octave = pitch / PITCH_DELTA_OCTAVE;
701
-
702
- // loop through the diatonic steps of the key looking for the given note
703
- // or the gap where it would fit
704
- int i = 0 ;
705
- while (i < 7 ) {
706
- if (ptab[key][i] >= step) {
707
- break ;
708
- }
709
- ++i;
710
- }
711
-
712
- // neither step nor gap found
713
- // reset to beginning
714
- if (i == 7 ) {
715
- ++octave;
716
- i = 0 ;
717
- }
718
- // if given step not found (gap found instead), and we are stepping up
719
- // then we've already accounted for one step
720
- if (ptab[key][i] > step && steps > 0 ) {
721
- --steps;
722
- }
723
-
724
- // now start counting diatonic steps up or down
725
- if (steps > 0 ) {
726
- // count up
727
- while (steps--) {
728
- ++i;
729
- if (i == 7 ) {
730
- // hit last step; reset to beginning
731
- ++octave;
732
- i = 0 ;
733
- }
734
- }
735
- } else if (steps < 0 ) {
736
- // count down
737
- while (steps++) {
738
- --i;
739
- if (i < 0 ) {
740
- // hit first step; reset to end
741
- --octave;
742
- i = 6 ;
743
- }
744
- }
745
- }
746
-
747
- // convert step to pitch
748
- step = ptab[key][i];
749
- pitch = std::clamp (octave * PITCH_DELTA_OCTAVE + step, MIN_PITCH, MAX_PITCH + 1 );
750
-
751
- return pitch;
752
- }
753
-
754
669
// ---------------------------------------------------------
755
670
// searchTieNote
756
671
// search Note to tie to "note"
0 commit comments