mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Add correct AudioLeadIn support
This commit is contained in:
@ -41,6 +41,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private readonly double gameplayStartTime;
|
||||
|
||||
private readonly double firstHitObjectTime;
|
||||
|
||||
public readonly Bindable<double> UserPlaybackRate = new BindableDouble(1)
|
||||
{
|
||||
Default = 1,
|
||||
@ -61,11 +63,12 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private readonly FramedOffsetClock platformOffsetClock;
|
||||
|
||||
public GameplayClockContainer(WorkingBeatmap beatmap, IReadOnlyList<Mod> mods, double gameplayStartTime)
|
||||
public GameplayClockContainer(WorkingBeatmap beatmap, IReadOnlyList<Mod> mods, double gameplayStartTime, double firstHitObjectTime)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
this.mods = mods;
|
||||
this.gameplayStartTime = gameplayStartTime;
|
||||
this.firstHitObjectTime = firstHitObjectTime;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
@ -102,11 +105,17 @@ namespace osu.Game.Screens.Play
|
||||
userAudioOffset = config.GetBindable<double>(OsuSetting.AudioOffset);
|
||||
userAudioOffset.BindValueChanged(offset => userOffsetClock.Offset = offset.NewValue, true);
|
||||
|
||||
double startTime = -beatmap.BeatmapInfo.AudioLeadIn;
|
||||
// sane default provided by ruleset.
|
||||
double startTime = Math.Min(0, gameplayStartTime);
|
||||
|
||||
// if a storyboard is present, it may dictate the appropriate start time by having events in negative time space.
|
||||
// this is commonly used to display an intro before the audio track start.
|
||||
startTime = Math.Min(startTime, beatmap.Storyboard.FirstEventTime);
|
||||
startTime = Math.Min(startTime, gameplayStartTime);
|
||||
startTime = Math.Min(startTime, 0);
|
||||
|
||||
// some beatmaps specify a current lead-in time which should be used instead of the ruleset-provided value when available.
|
||||
// this is not available as an option in the live editor but can still be applied via .osu editing.
|
||||
if (beatmap.BeatmapInfo.AudioLeadIn > 0)
|
||||
startTime = Math.Min(startTime, firstHitObjectTime - beatmap.BeatmapInfo.AudioLeadIn);
|
||||
|
||||
Seek(startTime);
|
||||
|
||||
|
@ -129,7 +129,7 @@ namespace osu.Game.Screens.Play
|
||||
if (!ScoreProcessor.Mode.Disabled)
|
||||
config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
|
||||
|
||||
InternalChild = GameplayClockContainer = new GameplayClockContainer(working, Mods.Value, DrawableRuleset.GameplayStartTime);
|
||||
InternalChild = GameplayClockContainer = new GameplayClockContainer(working, Mods.Value, DrawableRuleset.GameplayStartTime, DrawableRuleset.Objects.First().StartTime);
|
||||
|
||||
addUnderlayComponents(GameplayClockContainer);
|
||||
addGameplayComponents(GameplayClockContainer, working);
|
||||
|
Reference in New Issue
Block a user