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

Schedule new track assignment after stopping current track

This commit is contained in:
iiSaLMaN 2019-11-08 13:19:06 +03:00
parent 6805c029e7
commit 8ef9ccc39e

View File

@ -46,12 +46,18 @@ namespace osu.Game.Audio
{
var track = CreatePreviewTrack(beatmapSetInfo, trackStore);
track.Started += () => Schedule(() =>
track.Started += () =>
{
// Stopping track should not be within the below schedule since its stop event schedules a null assign to current.
// Due to that, assigning the new track to current must be scheduled after the null assign to avoid current track loss.
current?.Stop();
current = track;
audio.Tracks.AddAdjustment(AdjustableProperty.Volume, muteBindable);
});
Schedule(() =>
{
current = track;
audio.Tracks.AddAdjustment(AdjustableProperty.Volume, muteBindable);
});
};
track.Stopped += () => Schedule(() =>
{