1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-05 02:43:16 +08:00

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

View File

@ -44,7 +44,7 @@ namespace osu.Game.Screens.Play
/// By default, a value of zero will be used. /// 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. /// Importantly, the value will be inferred from the current beatmap in <see cref="MasterGameplayClockContainer"/> by default.
/// </remarks> /// </remarks>
public double StartTime { get; private set; } public double StartTime { get; protected set; }
public virtual IEnumerable<double> NonGameplayAdjustments => Enumerable.Empty<double>(); public virtual IEnumerable<double> NonGameplayAdjustments => Enumerable.Empty<double>();
@ -71,7 +71,7 @@ namespace osu.Game.Screens.Play
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
GameplayClock = new FramedBeatmapClock(sourceClock, applyOffsets) { IsCoupled = false }, GameplayClock = new FramedBeatmapClock(applyOffsets) { IsCoupled = false },
Content Content
}; };
} }

View File

@ -58,7 +58,7 @@ namespace osu.Game.Screens.Play
this.beatmap = beatmap; this.beatmap = beatmap;
this.skipTargetTime = skipTargetTime; this.skipTargetTime = skipTargetTime;
Reset(findEarliestStartTime()); StartTime = findEarliestStartTime();
} }
private double findEarliestStartTime() private double findEarliestStartTime()