Avoid setting the source clock until gameplay is ready to start

Without this change, the audio track may audibly seek during load
proceedings.
This commit is contained in:
Dean Herbert 2022-08-23 18:32:56 +09:00
parent ec61a94dc9
commit 29fed0c4a3
3 changed files with 4 additions and 5 deletions

View File

@ -70,14 +70,13 @@ public bool IsCoupled
set => decoupledClock.IsCoupled = value;
}
public FramedBeatmapClock(IClock? sourceClock = null, bool applyOffsets = false)
public FramedBeatmapClock(bool applyOffsets = false)
{
this.applyOffsets = applyOffsets;
// A decoupled clock is used to ensure precise time values even when the host audio subsystem is not reporting
// high precision times (on windows there's generally only 5-10ms reporting intervals, as an example).
decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = true };
decoupledClock.ChangeSource(sourceClock);
if (applyOffsets)
{

View File

@ -44,7 +44,7 @@ public class GameplayClockContainer : Container, IAdjustableClock, IGameplayCloc
/// By default, a value of zero will be used.
/// Importantly, the value will be inferred from the current beatmap in <see cref="MasterGameplayClockContainer"/> by default.
/// </remarks>
public double StartTime { get; private set; }
public double StartTime { get; protected set; }
public virtual IEnumerable<double> NonGameplayAdjustments => Enumerable.Empty<double>();
@ -71,7 +71,7 @@ public GameplayClockContainer(IClock sourceClock, bool applyOffsets = false)
InternalChildren = new Drawable[]
{
GameplayClock = new FramedBeatmapClock(sourceClock, applyOffsets) { IsCoupled = false },
GameplayClock = new FramedBeatmapClock(applyOffsets) { IsCoupled = false },
Content
};
}

View File

@ -58,7 +58,7 @@ public MasterGameplayClockContainer(WorkingBeatmap beatmap, double skipTargetTim
this.beatmap = beatmap;
this.skipTargetTime = skipTargetTime;
Reset(findEarliestStartTime());
StartTime = findEarliestStartTime();
}
private double findEarliestStartTime()