// 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.Bindables; using osu.Game.Beatmaps.Timing; namespace osu.Game.Beatmaps.ControlPoints { public class TimingControlPoint : ControlPoint { /// /// The time signature at this control point. /// public readonly Bindable TimeSignatureBindable = new Bindable(TimeSignatures.SimpleQuadruple) { Default = TimeSignatures.SimpleQuadruple }; /// /// The time signature at this control point. /// public TimeSignatures TimeSignature { get => TimeSignatureBindable.Value; set => TimeSignatureBindable.Value = value; } public const double DEFAULT_BEAT_LENGTH = 1000; /// /// The beat length at this control point. /// public readonly BindableDouble BeatLengthBindable = new BindableDouble(DEFAULT_BEAT_LENGTH) { Default = DEFAULT_BEAT_LENGTH, MinValue = 6, MaxValue = 60000 }; /// /// The beat length at this control point. /// public double BeatLength { get => BeatLengthBindable.Value; set => BeatLengthBindable.Value = value; } /// /// The BPM at this control point. /// public double BPM => 60000 / BeatLength; public override bool EquivalentTo(ControlPoint other) => other is TimingControlPoint otherTyped && TimeSignature == otherTyped.TimeSignature && BeatLength.Equals(otherTyped.BeatLength); public override bool IsRedundant(ControlPoint existing, double time) => EquivalentTo(existing) && existing.Time == time; } }