mirror of https://github.com/ppy/osu
Use a decoupled clock for triangles intro to avoid startup freezes on broken audio device
This commit is contained in:
parent
2c6ee0ebf7
commit
ba99a808af
|
@ -165,7 +165,7 @@ public override void OnSuspending(IScreen next)
|
|||
|
||||
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)
|
||||
|
|
|
@ -41,6 +41,8 @@ public class IntroTriangles : IntroScreen
|
|||
|
||||
private Sample welcome;
|
||||
|
||||
private DecoupleableInterpolatingFramedClock decoupledClock;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
|
@ -56,10 +58,18 @@ protected override void LogoArriving(OsuLogo logo, bool resuming)
|
|||
{
|
||||
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,12 @@ public override void OnResuming(IScreen last)
|
|||
background.FadeOut(100);
|
||||
}
|
||||
|
||||
protected override void StartTrack()
|
||||
{
|
||||
if (UsingThemedIntro)
|
||||
decoupledClock.Start();
|
||||
}
|
||||
|
||||
private class TrianglesIntroSequence : CompositeDrawable
|
||||
{
|
||||
private readonly OsuLogo logo;
|
||||
|
|
Loading…
Reference in New Issue