Пример #1
0
        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);
        }
Пример #2
0
        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);
        }