mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 04:53:06 +08:00
Use track check solution for this
This commit is contained in:
parent
901a8d597b
commit
20ed6c4d52
@ -46,21 +46,20 @@ namespace osu.Game.Audio
|
|||||||
{
|
{
|
||||||
var track = CreatePreviewTrack(beatmapSetInfo, trackStore);
|
var track = CreatePreviewTrack(beatmapSetInfo, trackStore);
|
||||||
|
|
||||||
track.Started += () =>
|
track.Started += () => Schedule(() =>
|
||||||
{
|
{
|
||||||
// Stopping track should not be within the below schedule since its stop event schedules a null assign to current.
|
var last = current;
|
||||||
// Due to that, assigning the new track to current must be scheduled after the null assign to avoid current track loss.
|
current = track;
|
||||||
current?.Stop();
|
last?.Stop();
|
||||||
|
|
||||||
Schedule(() =>
|
audio.Tracks.AddAdjustment(AdjustableProperty.Volume, muteBindable);
|
||||||
{
|
});
|
||||||
current = track;
|
|
||||||
audio.Tracks.AddAdjustment(AdjustableProperty.Volume, muteBindable);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
track.Stopped += () => Schedule(() =>
|
track.Stopped += () => Schedule(() =>
|
||||||
{
|
{
|
||||||
|
if (current != track)
|
||||||
|
return;
|
||||||
|
|
||||||
current = null;
|
current = null;
|
||||||
audio.Tracks.RemoveAdjustment(AdjustableProperty.Volume, muteBindable);
|
audio.Tracks.RemoveAdjustment(AdjustableProperty.Volume, muteBindable);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user