Skip to content

Commit

Permalink
Fix low pass filter sometimes not applied in dialog overlays
Browse files Browse the repository at this point in the history
  • Loading branch information
smoogipoo committed Jun 28, 2024
1 parent 1668048 commit 77b00da
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions osu.Game/Overlays/Dialog/PopupDialogDangerousButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#nullable disable

using System;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
Expand Down Expand Up @@ -71,7 +72,7 @@ private void load(AudioManager audio)
protected override void LoadComplete()
{
base.LoadComplete();
Progress.BindValueChanged(progressChanged);
Progress.BindValueChanged(progressChanged, true);
}

protected override void AbortConfirm()
Expand Down Expand Up @@ -122,11 +123,13 @@ protected override void OnHoverLost(HoverLostEvent e)

private void progressChanged(ValueChangedEvent<double> progress)
{
if (progress.NewValue < progress.OldValue) return;
lowPassFilter.Cutoff = Math.Max(1, (int)(progress.NewValue * AudioFilter.MAX_LOWPASS_CUTOFF * 0.5));

if (Clock.CurrentTime - lastTickPlaybackTime < 30) return;
if (progress.NewValue < progress.OldValue)
return;

lowPassFilter.CutoffTo((int)(progress.NewValue * AudioFilter.MAX_LOWPASS_CUTOFF * 0.5));
if (Clock.CurrentTime - lastTickPlaybackTime < 30)
return;

var channel = tickSample.GetChannel();

Expand Down

0 comments on commit 77b00da

Please sign in to comment.