Invalidate waveform on track load

This commit is contained in:
ansel 2022-12-22 20:49:09 +03:00
parent d0645ce151
commit 20370bd5ae
2 changed files with 9 additions and 8 deletions

View File

@ -105,7 +105,14 @@ public void CancelAsyncLoad()
public virtual bool TrackLoaded => track != null;
public Track LoadTrack() => track = GetBeatmapTrack() ?? GetVirtualTrack(1000);
public Track LoadTrack()
{
// track could be changed, clearing waveform cache
waveform = null;
track = GetBeatmapTrack() ?? GetVirtualTrack(1000);
return track;
}
public void PrepareTrackForPreview(bool looping, double offsetFromPreviewPoint = 0)
{
@ -172,12 +179,6 @@ protected Track GetVirtualTrack(double emptyLength = 0)
public Waveform Waveform => waveform ??= GetWaveform();
/// <summary>
/// Reloads waveform of beatmap's track even if one is already cached.
/// </summary>
/// <returns>Newly loaded waveform.</returns>
public Waveform LoadWaveform() => waveform = GetWaveform();
#endregion
#region Beatmap

View File

@ -118,7 +118,7 @@ public bool ChangeAudioTrack(FileInfo source)
}
working.Value.Metadata.AudioFile = destination.Name;
working.Value.LoadWaveform();
editorBeatmap.SaveState();
music.ReloadCurrentTrack();