Use bindable for track to fix rate adjustments not applying correctly

This commit is contained in:
Dean Herbert
2020-09-24 19:01:28 +09:00
parent 978f6edf38
commit 7e7e2fd64a
3 changed files with 14 additions and 7 deletions

View File

@ -4,6 +4,7 @@
using System;
using System.Linq;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Utils;
@ -18,7 +19,11 @@ namespace osu.Game.Screens.Edit
/// </summary>
public class EditorClock : Component, IFrameBasedClock, IAdjustableClock, ISourceChangeableClock
{
public double TrackLength;
public IBindable<Track> Track => track;
private readonly Bindable<Track> track = new Bindable<Track>();
public double TrackLength => track.Value?.Length ?? 60000;
public ControlPointInfo ControlPointInfo;
@ -36,7 +41,6 @@ namespace osu.Game.Screens.Edit
this.beatDivisor = beatDivisor;
ControlPointInfo = controlPointInfo;
TrackLength = trackLength;
underlyingClock = new DecoupleableInterpolatingFramedClock();
}
@ -193,8 +197,8 @@ namespace osu.Game.Screens.Edit
public void ChangeSource(IClock source)
{
track.Value = source as Track;
underlyingClock.ChangeSource(source);
TrackLength = (source as Track)?.Length ?? 60000;
}
public IClock Source => underlyingClock.Source;