mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Merge remote-tracking branch 'upstream/master' into fix-network-stalls
This commit is contained in:
@ -14,11 +14,13 @@ namespace osu.Game.Audio
|
||||
{
|
||||
/// <summary>
|
||||
/// Invoked when this <see cref="PreviewTrack"/> has stopped playing.
|
||||
/// Not invoked in a thread-safe context.
|
||||
/// </summary>
|
||||
public event Action Stopped;
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when this <see cref="PreviewTrack"/> has started playing.
|
||||
/// Not invoked in a thread-safe context.
|
||||
/// </summary>
|
||||
public event Action Started;
|
||||
|
||||
@ -30,7 +32,7 @@ namespace osu.Game.Audio
|
||||
{
|
||||
track = GetTrack();
|
||||
if (track != null)
|
||||
track.Completed += () => Schedule(Stop);
|
||||
track.Completed += Stop;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -94,6 +96,7 @@ namespace osu.Game.Audio
|
||||
hasStarted = false;
|
||||
|
||||
track.Stop();
|
||||
|
||||
Stopped?.Invoke();
|
||||
}
|
||||
|
||||
|
@ -46,18 +46,18 @@ namespace osu.Game.Audio
|
||||
{
|
||||
var track = CreatePreviewTrack(beatmapSetInfo, trackStore);
|
||||
|
||||
track.Started += () =>
|
||||
track.Started += () => Schedule(() =>
|
||||
{
|
||||
current?.Stop();
|
||||
current = track;
|
||||
audio.Tracks.AddAdjustment(AdjustableProperty.Volume, muteBindable);
|
||||
};
|
||||
});
|
||||
|
||||
track.Stopped += () =>
|
||||
track.Stopped += () => Schedule(() =>
|
||||
{
|
||||
current = null;
|
||||
audio.Tracks.RemoveAdjustment(AdjustableProperty.Volume, muteBindable);
|
||||
};
|
||||
});
|
||||
|
||||
return track;
|
||||
}
|
||||
|
Reference in New Issue
Block a user