mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +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:
parent
9bb0663b3b
commit
cd1f6b46c4
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user