Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add visual offset to better align editor waveforms with expectations #26136

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours, OsuConfi
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);
}
Expand Down
13 changes: 13 additions & 0 deletions osu.Game/Screens/Edit/Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private void regenerateDisplay(bool animated)
// 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);
Expand Down