public void AddBar(BarTickLookup bar) { Bars.Add(bar); if (!BarLookup.ContainsKey(bar.Bar.Index)) { BarLookup[bar.Bar.Index] = bar; } }
public static MidiTickLookup BuildTickLookup(Score score) { var lookup = new MidiTickLookup(); var controller = new MidiPlaybackController(score); while (!controller.Finished) { var index = controller.Index; controller.Process(); if (controller.ShouldPlay) { var bar = new BarTickLookup(); bar.Bar = score.MasterBars[index]; bar.Start = controller.RepeatMove + bar.Bar.Start; bar.End = bar.Start + bar.Bar.CalculateDuration(); lookup.Bars.Add(bar); } } return lookup; }
public static MidiTickLookup BuildTickLookup(Score score) { var lookup = new MidiTickLookup(); var controller = new MidiPlaybackController(score); while (!controller.Finished) { var index = controller.Index; var currentTick = controller.CurrentTick; controller.ProcessCurrent(); if (controller.ShouldPlay) { var bar = new BarTickLookup(); bar.Bar = score.MasterBars[index]; bar.Start = currentTick; bar.End = bar.Start + bar.Bar.CalculateDuration(); lookup.AddBar(bar); } controller.MoveNext(); } return lookup; }