/// <summary>Returns the index of the specified <seealso cref="TimingPoint"/> in the list.</summary> /// <param name="timingPoint">The <seealso cref="TimingPoint"/> whose index in the list to get.</param> public int IndexOf(TimingPoint timingPoint) => timingPoints.BinarySearch(timingPoint);
/// <summary>Adds a <seealso cref="TimingPoint"/> to the list.</summary> /// <param name="timingPoint">The <seealso cref="TimingPoint"/> to add to the list.</param> public void Add(TimingPoint timingPoint) => RecalculateTimePositions(timingPoints.Insert(timingPoint) + 1);
private static int CompareTimingPoints(TimingPoint left, TimingPoint right) => left.GetRelativeTimePosition().CompareTo(right.GetRelativeTimePosition());
/// <inheritdoc/> public override void CalculateTimePosition(TimingPoint previous) => CalculateAbsoluteTimePosition(previous);
/// <inheritdoc/> protected override int CompareTimePosition(TimingPoint other) => TimePosition.CompareTo(other.GetRelativeTimePosition());
/// <summary>Calculates the absolute time position of this relative timing poing based on a previous <seealso cref="TimingPoint"/>.</summary> /// <param name="previous">The previous <seealso cref="TimingPoint"/> based on which to calculate the absolute time position.</param> public void CalculateAbsoluteTimePosition(TimingPoint previous) { // F**k this is so long AbsoluteTimePosition = previous.GetAbsoluteTimePosition() + previous.BPM.GetDurationTimeSpan(TimePosition.DistanceFrom(previous.GetRelativeTimePosition(), previous.TimeSignature), previous.TimeSignature); }