Exemplo n.º 1
0
        public string Serialize(ChordOffset chordOffset)
        {
            var stringBuilder = new StringBuilder();

            stringBuilder.Append(_chordSerializer.Serialize(chordOffset.Chord));

            return(stringBuilder.ToString());
        }
        private static void AssertChord(ChordOffset chordOffset, Note.Keys expectedNote, Note.Octaves expectedOctave, decimal expectedOffset, Fraction expectedFraction)
        {
            Assert.That(chordOffset.Offest.Value, Is.EqualTo(expectedOffset));
            Assert.That(chordOffset.Chord.Length, Is.EqualTo(expectedFraction));
            var note = chordOffset.Chord.Notes.ElementAt(0);

            Assert.That(note.Key, Is.EqualTo(expectedNote));
            Assert.That(note.Octave, Is.EqualTo(expectedOctave));
        }
Exemplo n.º 3
0
        private IEnumerable <ChordOffset> ParseMelody(string textMelody)
        {
            var currentBeat = 0m;

            return(NonWhitespace.Matches(textMelody)
                   .Cast <Match>()
                   .Select(textChord =>
            {
                var chord = _chordParser.Parse(textChord.Value);

                var chordOffset = new ChordOffset(chord, new Beat(currentBeat));

                currentBeat += chord.Length;

                return chordOffset;
            }));
        }