1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:47:24 +08:00

Fix crash after changing audio track in editor

Closes https://github.com/ppy/osu/issues/26213.

Reproduction scenario: switch audio track in editor after timeline
loads.

Happens because `beatmap.Value.Track.Length` is 0 immediately after a
track switch, until BASS computes the actual track length on the audio
thread.

Yes this is a hack. No I have no better immediate ideas how to address
this otherwise.
This commit is contained in:
Bartłomiej Dach 2023-12-29 10:24:48 +01:00
parent 9bb0663b3b
commit cd1f6b46c4
No known key found for this signature in database

View File

@ -141,12 +141,13 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
track.BindTo(editorClock.Track);
track.BindValueChanged(_ =>
// schedule added as without it, `beatmap.Value.Track.Length` can be 0 immediately after a track switch.
track.BindValueChanged(_ => Schedule(() =>
{
waveform.Waveform = beatmap.Value.Waveform;
waveform.RelativePositionAxes = Axes.X;
waveform.X = -(float)(Editor.WAVEFORM_VISUAL_OFFSET / beatmap.Value.Track.Length);
}, true);
}), true);
Zoom = (float)(defaultTimelineZoom * editorBeatmap.BeatmapInfo.TimelineZoom);
}