1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:07:25 +08:00

Add visual offset to better align editor waveforms with expectations

This commit is contained in:
Dean Herbert 2023-12-26 17:44:49 +09:00
parent ef4191fb57
commit f9e47242db
No known key found for this signature in database
3 changed files with 20 additions and 2 deletions

View File

@ -141,7 +141,12 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
track.BindTo(editorClock.Track);
track.BindValueChanged(_ => waveform.Waveform = beatmap.Value.Waveform, true);
track.BindValueChanged(_ =>
{
waveform.Waveform = beatmap.Value.Waveform;
waveform.RelativePositionAxes = Axes.X;
waveform.X = -(float)(Editor.WAVEFORM_VISUAL_OFFSET / beatmap.Value.Track.Length);
}, true);
Zoom = (float)(defaultTimelineZoom * editorBeatmap.BeatmapInfo.TimelineZoom);
}

View File

@ -60,6 +60,19 @@ namespace osu.Game.Screens.Edit
[Cached]
public partial class Editor : ScreenWithBeatmapBackground, IKeyBindingHandler<GlobalAction>, IKeyBindingHandler<PlatformAction>, IBeatSnapProvider, ISamplePlaybackDisabler, IBeatSyncProvider
{
/// <summary>
/// An offset applied to waveform visuals to align them with expectations.
/// </summary>
/// <remarks>
/// Historically, osu! beatmaps have an assumption of full system latency baked in.
/// This comes from a culmination of stable's platform offset, average hardware playback
/// latency, and users having their universal offsets tweaked to previous beatmaps.
///
/// Coming to this value involved running various tests with existing users / beatmaps.
/// This included both visual and audible comparisons. Ballpark confidence is ≈2 ms.
/// </remarks>
public const float WAVEFORM_VISUAL_OFFSET = 20;
public override float BackgroundParallaxAmount => 0.1f;
public override bool AllowBackButton => false;

View File

@ -219,7 +219,7 @@ namespace osu.Game.Screens.Edit.Timing
// offset to the required beat index.
double time = selectedGroupStartTime + index * timingPoint.BeatLength;
float offset = (float)(time - visible_width / 2) / trackLength * scale;
float offset = (float)(time - visible_width / 2 + Editor.WAVEFORM_VISUAL_OFFSET) / trackLength * scale;
row.Alpha = time < selectedGroupStartTime || time > selectedGroupEndTime ? 0.2f : 1;
row.WaveformOffsetTo(-offset, animated);