Example #1
0
        public List <TimeSpan> GetBeats()
        {
            List <TimeSpan> result = new List <TimeSpan>();

            TimeSpan threshold = TimeSpan.FromMilliseconds(10);

            TimeSpan position = TimePanel.GetPosition(_parent);
            TimeSpan duration = TimePanel.GetDuration(_parent);

            TimeSpan currentPosition = position;
            TimeSpan endposition     = position + duration;

            var pattern = BeatDefinition.Pattern;

            TimeSpan beatLength = PatternDuration.Divide(pattern.Length);

            while (endposition - currentPosition > threshold)
            {
                foreach (bool isactive in pattern)
                {
                    if (isactive)
                    {
                        result.Add(currentPosition);
                    }
                    currentPosition += beatLength;

                    if (endposition - currentPosition <= threshold)
                    {
                        break;
                    }
                }
            }

            return(result);
        }
Example #2
0
        public BeatSegment GetBeatSegment()
        {
            BeatSegment summary = BeatLine.GetBeatSegment();

            summary.Duration = TimePanel.GetDuration(this).Ticks;
            summary.Position = TimePanel.GetPosition(this).Ticks;

            return(summary);
        }