예제 #1
0
        private int ParseChord(string s, int index, NoteContext context)
        {
            if (context.IsRest)
            {
                return(index);
            }

            int lengthOfChordString = 0;

            string[] chordNames = Chord.GetChordNames();
            foreach (string chordName in chordNames)
            {
                if ((s.Length >= index + chordName.Length) && chordName == s.Substring(index, chordName.Length))
                {
                    lengthOfChordString = chordName.Length;
                    context.IsChord     = true;
                    context.Intervals   = Chord.GetIntervals(chordName);
                    context.ChordName   = chordName;
                    break;
                }
            }
            return(index + lengthOfChordString);
        }