public void Play(Harp harp, MetronomeMark metronomeMark, ChordOffset[] melody) { var stopwatch = new Stopwatch(); stopwatch.Start(); for (var strumIndex = 0; strumIndex < melody.Length;) { var strum = melody[strumIndex]; if (stopwatch.ElapsedMilliseconds > metronomeMark.WholeNoteLength.Multiply(strum.Offest).TotalMilliseconds) { var chord = strum.Chord; foreach (var note in chord.Notes) { harp.GoToOctave(note); harp.PlayNote(note); } strumIndex++; } else { Thread.Sleep(TimeSpan.FromMilliseconds(1)); } } stopwatch.Stop(); }
private static void PrepareNoteOctave(Harp harp, Note note) { harp.GoToOctave(note); }
private static void PrepareChordsOctave(Harp harp, Chord chord) { harp.GoToOctave(chord.Notes.First()); }