2019-01-24 08:43:03 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
2019-10-28 05:44:45 +00:00
|
|
|
using osu.Framework.Bindables;
|
2018-04-13 09:19:50 +00:00
|
|
|
using osu.Game.Beatmaps.Timing;
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps.ControlPoints
|
|
|
|
{
|
2019-10-25 08:00:56 +00:00
|
|
|
public class TimingControlPoint : ControlPoint
|
2018-04-13 09:19:50 +00:00
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// The time signature at this control point.
|
|
|
|
/// </summary>
|
2019-10-28 07:21:14 +00:00
|
|
|
public readonly Bindable<TimeSignatures> TimeSignatureBindable = new Bindable<TimeSignatures>(TimeSignatures.SimpleQuadruple) { Default = TimeSignatures.SimpleQuadruple };
|
2019-10-28 05:44:45 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The time signature at this control point.
|
|
|
|
/// </summary>
|
|
|
|
public TimeSignatures TimeSignature
|
|
|
|
{
|
|
|
|
get => TimeSignatureBindable.Value;
|
|
|
|
set => TimeSignatureBindable.Value = value;
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
2019-08-28 11:22:16 +00:00
|
|
|
public const double DEFAULT_BEAT_LENGTH = 1000;
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
/// <summary>
|
|
|
|
/// The beat length at this control point.
|
|
|
|
/// </summary>
|
2019-10-28 05:44:45 +00:00
|
|
|
public readonly BindableDouble BeatLengthBindable = new BindableDouble(DEFAULT_BEAT_LENGTH)
|
2018-04-13 09:19:50 +00:00
|
|
|
{
|
2019-10-28 07:21:14 +00:00
|
|
|
Default = DEFAULT_BEAT_LENGTH,
|
2019-10-28 05:44:45 +00:00
|
|
|
MinValue = 6,
|
|
|
|
MaxValue = 60000
|
|
|
|
};
|
2018-04-13 09:19:50 +00:00
|
|
|
|
2019-10-30 09:44:07 +00:00
|
|
|
/// <summary>
|
2019-10-28 05:44:45 +00:00
|
|
|
/// The beat length at this control point.
|
|
|
|
/// </summary>
|
|
|
|
public double BeatLength
|
|
|
|
{
|
|
|
|
get => BeatLengthBindable.Value;
|
|
|
|
set => BeatLengthBindable.Value = value;
|
2018-04-13 09:19:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-28 03:31:38 +00:00
|
|
|
/// <summary>
|
|
|
|
/// The BPM at this control point.
|
|
|
|
/// </summary>
|
|
|
|
public double BPM => 60000 / BeatLength;
|
|
|
|
|
2019-10-25 08:00:56 +00:00
|
|
|
public override bool EquivalentTo(ControlPoint other) =>
|
|
|
|
other is TimingControlPoint otherTyped
|
2019-10-28 05:44:45 +00:00
|
|
|
&& TimeSignature == otherTyped.TimeSignature && BeatLength.Equals(otherTyped.BeatLength);
|
2018-04-13 09:19:50 +00:00
|
|
|
}
|
|
|
|
}
|