1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 23:52:57 +08:00

Fix HitObject samples getting stuck in a playing state on seeking far into the future

This commit is contained in:
Dean Herbert 2020-09-29 15:07:55 +09:00
parent 56c8e4dacf
commit 5d1c377379
4 changed files with 21 additions and 1 deletions

View File

@ -110,6 +110,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}
}
public override void StopAllSamples()
{
base.StopAllSamples();
slidingSample?.Stop();
}
private void updateSlidingSample(ValueChangedEvent<bool> tracking)
{
if (tracking.NewValue)

View File

@ -124,6 +124,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}
}
public override void StopAllSamples()
{
base.StopAllSamples();
spinningSample?.Stop();
}
protected override void AddNestedHitObject(DrawableHitObject hitObject)
{
base.AddNestedHitObject(hitObject);

View File

@ -387,6 +387,11 @@ namespace osu.Game.Rulesets.Objects.Drawables
}
}
/// <summary>
/// Stops playback of all samples. Automatically called when <see cref="DrawableHitObject{TObject}"/>'s lifetime has been exceeded.
/// </summary>
public virtual void StopAllSamples() => Samples?.Stop();
protected override void Update()
{
base.Update();
@ -455,6 +460,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
foreach (var nested in NestedHitObjects)
nested.OnKilled();
StopAllSamples();
UpdateResult(false);
}

View File

@ -73,7 +73,8 @@ namespace osu.Game.Skinning
// it's not easy to know if a sample has finished playing (to end).
// to keep things simple only resume playing looping samples.
else if (Looping)
play();
// schedule so we don't start playing a sample which is no longer alive.
Schedule(play);
}
});
}