// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Edit { /// /// A snap provider which given a reference hit object and proposed distance from it, offers a more correct duration or distance value. /// [Cached] public interface IDistanceSnapProvider { /// /// A multiplier which changes the ratio of distance travelled per time unit. /// Importantly, this is provided for manual usage, and not multiplied into any of the methods exposed by this interface. /// /// Bindable DistanceSpacingMultiplier { get; } /// /// Returns the spatial distance between objects which are temporally one beat apart. /// Depends on: /// /// the slider velocity taken from , /// the beatmap's ,, /// the current beat divisor. /// /// Note that the returned value does NOT depend on ; /// consumers are expected to include that multiplier as they see fit. /// float GetBeatSnapDistance(IHasSliderVelocity? withVelocity = null); /// /// Converts a temporal duration into a spatial distance. /// Does not perform any snapping. /// Depends on: /// /// the provided, /// a used to retrieve the beat length of the beatmap at that time, /// the slider velocity taken from , /// the beatmap's ,, /// the current beat divisor. /// /// Note that the returned value does NOT depend on ; /// consumers are expected to include that multiplier as they see fit. /// float DurationToDistance(double duration, double timingReference, IHasSliderVelocity? withVelocity = null); /// /// Converts a spatial distance into a temporal duration. /// Does not perform any snapping. /// Depends on: /// /// the provided, /// a used to retrieve the beat length of the beatmap at that time, /// the slider velocity taken from , /// the beatmap's ,, /// the current beat divisor. /// /// Note that the returned value does NOT depend on ; /// consumers are expected to include that multiplier as they see fit. /// double DistanceToDuration(float distance, double timingReference, IHasSliderVelocity? withVelocity = null); /// /// Snaps a spatial distance to the beat, relative to . /// Depends on: /// /// the provided, /// a used to retrieve the beat length of the beatmap at that time, /// the slider velocity taken from , /// the beatmap's ,, /// the current beat divisor. /// /// Note that the returned value does NOT depend on ; /// consumers are expected to include that multiplier as they see fit. /// float FindSnappedDistance(float distance, double snapReferenceTime, IHasSliderVelocity? withVelocity = null); } }