mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 20:53:04 +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)
|
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);
|
API.Register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private WorkingBeatmap lastBeatmap;
|
||||||
|
|
||||||
public void APIStateChanged(APIAccess api, APIState state)
|
public void APIStateChanged(APIAccess api, APIState state)
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
|
@ -158,7 +158,7 @@ namespace osu.Game.Overlays.Music
|
|||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
var track = beatmapBacking.Value.Track;
|
var track = beatmapBacking.Value.Track;
|
||||||
trackManager.SetExclusive(track);
|
trackManager.AddItem(track);
|
||||||
track.Start();
|
track.Start();
|
||||||
}).ContinueWith(task => Schedule(task.ThrowIfFaulted), TaskContinuationOptions.OnlyOnFaulted);
|
}).ContinueWith(task => Schedule(task.ThrowIfFaulted), TaskContinuationOptions.OnlyOnFaulted);
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
|
||||||
|
|
||||||
track = Beatmap.Value.Track;
|
track = Beatmap.Value.Track;
|
||||||
trackManager.SetExclusive(track);
|
trackManager.AddItem(track);
|
||||||
|
|
||||||
welcome = audio.Sample.Get(@"welcome");
|
welcome = audio.Sample.Get(@"welcome");
|
||||||
seeya = audio.Sample.Get(@"seeya");
|
seeya = audio.Sample.Get(@"seeya");
|
||||||
|
@ -120,7 +120,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
if (track != null)
|
if (track != null)
|
||||||
{
|
{
|
||||||
audio.Track.SetExclusive(track);
|
audio.Track.AddItem(track);
|
||||||
adjustableSourceClock = track;
|
adjustableSourceClock = track;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
Track track = Beatmap.Value.Track;
|
Track track = Beatmap.Value.Track;
|
||||||
|
|
||||||
trackManager.SetExclusive(track);
|
trackManager.AddItem(track);
|
||||||
|
|
||||||
if (preview) track.Seek(Beatmap.Value.Metadata.PreviewTime);
|
if (preview) track.Seek(Beatmap.Value.Metadata.PreviewTime);
|
||||||
track.Start();
|
track.Start();
|
||||||
|
Loading…
Reference in New Issue
Block a user