Пример #1
0
        private void UpdateTimeline(BeatTimeline oldValue, BeatTimeline newValue)
        {
            if (newValue != null)
            {
                newValue.ProgressChanged += Timeline_ProgressChanged;
            }

            if (oldValue != null)
            {
                oldValue.ProgressChanged -= Timeline_ProgressChanged;
            }
        }
        public static BeatTimeline FromTimestamps(List <double> beats)
        {
            var timeline = new BeatTimeline();

            if (beats.Count < 2)
            {
                return(timeline);
            }

            timeline.AppendBeatGroup(BeatGroup.Pause(TimeSpan.FromSeconds(beats[0])));

            for (int i = 1; i < beats.Count; i++)
            {
                timeline.AppendBeatGroup(BeatGroup.SingleBeat(TimeSpan.FromSeconds(beats[i] - beats[i - 1])));
            }

            return(timeline);
        }