mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 02:32:55 +08:00
Dispose previous waveform on track reload
This commit is contained in:
parent
20370bd5ae
commit
30de9ba795
@ -46,10 +46,11 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
private readonly object beatmapFetchLock = new object();
|
private readonly object beatmapFetchLock = new object();
|
||||||
|
|
||||||
private Waveform waveform;
|
|
||||||
private readonly Lazy<Storyboard> storyboard;
|
private readonly Lazy<Storyboard> storyboard;
|
||||||
private readonly Lazy<ISkin> skin;
|
private readonly Lazy<ISkin> skin;
|
||||||
|
|
||||||
private Track track; // track is not Lazy as we allow transferring and loading multiple times.
|
private Track track; // track is not Lazy as we allow transferring and loading multiple times.
|
||||||
|
private Waveform waveform; // waveform is also not Lazy as the track may change.
|
||||||
|
|
||||||
protected WorkingBeatmap(BeatmapInfo beatmapInfo, AudioManager audioManager)
|
protected WorkingBeatmap(BeatmapInfo beatmapInfo, AudioManager audioManager)
|
||||||
{
|
{
|
||||||
@ -107,10 +108,12 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public Track LoadTrack()
|
public Track LoadTrack()
|
||||||
{
|
{
|
||||||
// track could be changed, clearing waveform cache
|
track = GetBeatmapTrack() ?? GetVirtualTrack(1000);
|
||||||
|
|
||||||
|
// the track may have changed, recycle the current waveform.
|
||||||
|
waveform?.Dispose();
|
||||||
waveform = null;
|
waveform = null;
|
||||||
|
|
||||||
track = GetBeatmapTrack() ?? GetVirtualTrack(1000);
|
|
||||||
return track;
|
return track;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,12 +141,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
|
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
|
||||||
|
|
||||||
track.BindTo(editorClock.Track);
|
track.BindTo(editorClock.Track);
|
||||||
track.BindValueChanged(_ =>
|
track.BindValueChanged(_ => waveform.Waveform = beatmap.Value.Waveform, true);
|
||||||
{
|
|
||||||
waveform.Waveform = beatmap.Value.Waveform;
|
|
||||||
}, true);
|
|
||||||
|
|
||||||
waveform.Waveform = beatmap.Value.Waveform;
|
|
||||||
|
|
||||||
Zoom = (float)(defaultTimelineZoom * editorBeatmap.BeatmapInfo.TimelineZoom);
|
Zoom = (float)(defaultTimelineZoom * editorBeatmap.BeatmapInfo.TimelineZoom);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user