private void VerifyChordParsed(string s, Note note, string intervalsString)
        {
            ParseWithParser(s);
            var intervals = Chord.GetIntervals(intervalsString);
            var chord     = new Chord(note, intervals);

            VerifyEventRaised(nameof(Parser.ChordParsed))
            .WithArgs <ChordParsedEventArgs>(e => e.Chord.Equals(chord));
        }
Beispiel #2
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);
        }