Use static instances in all fallback ControlPoint lookups to reduce allocations

This commit is contained in:
Dean Herbert
2020-07-18 11:53:04 +09:00
parent fb5a54d242
commit 8147e67f53
5 changed files with 33 additions and 29 deletions

View File

@ -13,6 +13,18 @@ namespace osu.Game.Beatmaps.ControlPoints
/// </summary>
public readonly Bindable<TimeSignatures> TimeSignatureBindable = new Bindable<TimeSignatures>(TimeSignatures.SimpleQuadruple) { Default = TimeSignatures.SimpleQuadruple };
/// <summary>
/// Default length of a beat in milliseconds. Used whenever there is no beatmap or track playing.
/// </summary>
private const double default_beat_length = 60000.0 / 60.0;
public static readonly TimingControlPoint DEFAULT = new TimingControlPoint
{
BeatLength = default_beat_length,
BeatLengthBindable = { Disabled = true },
TimeSignatureBindable = { Disabled = true }
};
/// <summary>
/// The time signature at this control point.
/// </summary>