mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 10:12:53 +08:00
Merge pull request #14683 from peppy/use-decoupled-clock-triangles-intro
Use a decoupled clock for triangles intro to avoid startup freezes on broken audio device
This commit is contained in:
commit
1d9ad9478e
@ -115,7 +115,9 @@ namespace osu.Game.Screens.Menu
|
||||
if (setInfo == null)
|
||||
return false;
|
||||
|
||||
return (initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0])) != null;
|
||||
initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
|
||||
|
||||
return UsingThemedIntro = initialBeatmap != null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,7 +167,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
|
||||
|
||||
protected void StartTrack()
|
||||
protected virtual void StartTrack()
|
||||
{
|
||||
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
|
||||
if (UsingThemedIntro)
|
||||
@ -184,7 +186,6 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
beatmap.Value = initialBeatmap;
|
||||
Track = initialBeatmap.Track;
|
||||
UsingThemedIntro = !initialBeatmap.Track.IsDummyDevice;
|
||||
|
||||
// ensure the track starts at maximum volume
|
||||
musicController.CurrentTrack.FinishTransforms();
|
||||
|
@ -41,6 +41,8 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private Sample welcome;
|
||||
|
||||
private DecoupleableInterpolatingFramedClock decoupledClock;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
@ -56,10 +58,18 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
PrepareMenuLoad();
|
||||
|
||||
decoupledClock = new DecoupleableInterpolatingFramedClock
|
||||
{
|
||||
IsCoupled = false
|
||||
};
|
||||
|
||||
if (UsingThemedIntro)
|
||||
decoupledClock.ChangeSource(Track);
|
||||
|
||||
LoadComponentAsync(new TrianglesIntroSequence(logo, background)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Clock = new FramedClock(UsingThemedIntro ? Track : null),
|
||||
Clock = decoupledClock,
|
||||
LoadMenu = LoadMenu
|
||||
}, t =>
|
||||
{
|
||||
@ -78,6 +88,11 @@ namespace osu.Game.Screens.Menu
|
||||
background.FadeOut(100);
|
||||
}
|
||||
|
||||
protected override void StartTrack()
|
||||
{
|
||||
decoupledClock.Start();
|
||||
}
|
||||
|
||||
private class TrianglesIntroSequence : CompositeDrawable
|
||||
{
|
||||
private readonly OsuLogo logo;
|
||||
|
Loading…
Reference in New Issue
Block a user