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

Speed up metronome in timing screen when pressing control key #31342

Merged
merged 4 commits into from
Dec 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use 3x speed instead when beat snap divisor is divisible by 3
  • Loading branch information
minetoblend committed Dec 30, 2024
commit aa6763785c00a50d1624b1aebe2a400d63273fa8
16 changes: 14 additions & 2 deletions osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public partial class MetronomeDisplay : BeatSyncedContainer
[Resolved]
private OverlayColourProvider overlayColourProvider { get; set; } = null!;

[Resolved]
private BindableBeatDivisor beatDivisor { get; set; } = null!;

public bool EnableClicking
{
get => metronomeTick.EnableClicking;
Expand Down Expand Up @@ -233,10 +236,17 @@ private void load(AudioManager audio)

private ScheduledDelegate? latchDelegate;

private bool spedUp;

private bool divisorChanged;

private void setDivisor(int divisor)
private void updateDivisor()
{
int divisor = 1;

if (spedUp)
divisor = beatDivisor.Value % 3 == 0 ? 3 : 2;
bdach marked this conversation as resolved.
Show resolved Hide resolved

if (divisor == Divisor)
return;

Expand Down Expand Up @@ -264,6 +274,8 @@ protected override void Update()

timingPoint = BeatSyncSource.ControlPoints.TimingPointAt(BeatSyncSource.Clock.CurrentTime);

updateDivisor();

if (beatLength != timingPoint.BeatLength || divisorChanged)
{
beatLength = timingPoint.BeatLength;
Expand Down Expand Up @@ -346,7 +358,7 @@ protected override void OnKeyUp(KeyUpEvent e)
updateDivisorFromKey(e);
}

private void updateDivisorFromKey(UIEvent e) => setDivisor(e.ControlPressed ? 2 : 1);
private void updateDivisorFromKey(UIEvent e) => spedUp = e.ControlPressed;

private partial class MetronomeTick : BeatSyncedContainer
{
Expand Down