mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 05:56:42 +08:00
Remove usage of SetExclusive
Also immediately disposes WorkingBeatmaps on ValueChanged.
This commit is contained in:
parent
8417e59de3
commit
67b95926c4
@ -1 +1 @@
|
||||
Subproject commit 6b44a9f807fadcb3b3f044780d7e27d62ffe80ac
|
||||
Subproject commit a7edf9bb3bae6908f316ba0ee9dacdbbb66e8c19
|
@ -133,9 +133,20 @@ namespace osu.Game
|
||||
Token = LocalConfig.Get<string>(OsuSetting.Token)
|
||||
});
|
||||
|
||||
Beatmap.ValueChanged += b =>
|
||||
{
|
||||
// this disposal is done to stop the audio track.
|
||||
// it may not be exactly what we want for cases beatmaps are reused, as it will
|
||||
// trigger a fresh load of contained resources.
|
||||
lastBeatmap?.Dispose();
|
||||
lastBeatmap = b;
|
||||
};
|
||||
|
||||
API.Register(this);
|
||||
}
|
||||
|
||||
private WorkingBeatmap lastBeatmap;
|
||||
|
||||
public void APIStateChanged(APIAccess api, APIState state)
|
||||
{
|
||||
switch (state)
|
||||
|
@ -158,7 +158,7 @@ namespace osu.Game.Overlays.Music
|
||||
Task.Run(() =>
|
||||
{
|
||||
var track = beatmapBacking.Value.Track;
|
||||
trackManager.SetExclusive(track);
|
||||
trackManager.AddItem(track);
|
||||
track.Start();
|
||||
}).ContinueWith(task => Schedule(task.ThrowIfFaulted), TaskContinuationOptions.OnlyOnFaulted);
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ namespace osu.Game.Screens.Menu
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
|
||||
|
||||
track = Beatmap.Value.Track;
|
||||
trackManager.SetExclusive(track);
|
||||
trackManager.AddItem(track);
|
||||
|
||||
welcome = audio.Sample.Get(@"welcome");
|
||||
seeya = audio.Sample.Get(@"seeya");
|
||||
|
@ -120,7 +120,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
if (track != null)
|
||||
{
|
||||
audio.Track.SetExclusive(track);
|
||||
audio.Track.AddItem(track);
|
||||
adjustableSourceClock = track;
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
Track track = Beatmap.Value.Track;
|
||||
|
||||
trackManager.SetExclusive(track);
|
||||
trackManager.AddItem(track);
|
||||
|
||||
if (preview) track.Seek(Beatmap.Value.Metadata.PreviewTime);
|
||||
track.Start();
|
||||
|
Loading…
Reference in New Issue
Block a user