Esempio n. 1
0
        public override float GetSnappedDistanceFromDistance(double referenceTime, float distance)
        {
            double actualDuration = referenceTime + DistanceToDuration(referenceTime, distance);

            double snappedEndTime = BeatSnapProvider.SnapTime(actualDuration, referenceTime);

            double beatLength = BeatSnapProvider.GetBeatLengthAtTime(referenceTime);

            // we don't want to exceed the actual duration and snap to a point in the future.
            // as we are snapping to beat length via SnapTime (which will round-to-nearest), check for snapping in the forward direction and reverse it.
            if (snappedEndTime > actualDuration + 1)
            {
                snappedEndTime -= beatLength;
            }

            return(DurationToDistance(referenceTime, snappedEndTime - referenceTime));
        }
Esempio n. 2
0
        public virtual float FindSnappedDistance(HitObject referenceObject, float distance)
        {
            double startTime = referenceObject.StartTime;

            double actualDuration = startTime + DistanceToDuration(referenceObject, distance);

            double snappedEndTime = BeatSnapProvider.SnapTime(actualDuration, startTime);

            double beatLength = BeatSnapProvider.GetBeatLengthAtTime(startTime);

            // we don't want to exceed the actual duration and snap to a point in the future.
            // as we are snapping to beat length via SnapTime (which will round-to-nearest), check for snapping in the forward direction and reverse it.
            if (snappedEndTime > actualDuration + 1)
            {
                snappedEndTime -= beatLength;
            }

            return(DurationToDistance(referenceObject, snappedEndTime - startTime));
        }
Esempio n. 3
0
        public override double DistanceToDuration(HitObject referenceObject, float distance)
        {
            double beatLength = BeatSnapProvider.GetBeatLengthAtTime(referenceObject.StartTime);

            return(distance / GetBeatSnapDistanceAt(referenceObject) * beatLength);
        }
Esempio n. 4
0
        public override float DurationToDistance(HitObject referenceObject, double duration)
        {
            double beatLength = BeatSnapProvider.GetBeatLengthAtTime(referenceObject.StartTime);

            return((float)(duration / beatLength * GetBeatSnapDistanceAt(referenceObject)));
        }
Esempio n. 5
0
        public override double DistanceToDuration(double referenceTime, float distance)
        {
            double beatLength = BeatSnapProvider.GetBeatLengthAtTime(referenceTime);

            return(distance / GetBeatSnapDistanceAt(referenceTime) * beatLength);
        }
Esempio n. 6
0
        public override float DurationToDistance(double referenceTime, double duration)
        {
            double beatLength = BeatSnapProvider.GetBeatLengthAtTime(referenceTime);

            return((float)(duration / beatLength * GetBeatSnapDistanceAt(referenceTime)));
        }