From 29a46f5b368273e8acf874a8c7182a93293b35fd Mon Sep 17 00:00:00 2001 From: tsrk Date: Fri, 25 Aug 2023 11:46:09 +0200 Subject: [PATCH] style(editor/checks): add issues for delays with no silence --- .../Edit/Checks/CheckDelayedHitsounds.cs | 40 +++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Edit/Checks/CheckDelayedHitsounds.cs b/osu.Game/Rulesets/Edit/Checks/CheckDelayedHitsounds.cs index 124a549088..323888a450 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckDelayedHitsounds.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckDelayedHitsounds.cs @@ -32,7 +32,9 @@ namespace osu.Game.Rulesets.Edit.Checks { new IssueTemplateConsequentDelay(this), new IssueTemplateDelay(this), - new IssuTemplateMinorDelay(this) + new IssueTemplateDelayNoSilence(this), + new IssuTemplateMinorDelay(this), + new IssuTemplateMinorDelayNoSilence(this), }; private float getAverageAmplitude(Waveform.Point point) => (point.AmplitudeLeft + point.AmplitudeRight) / 2; @@ -93,9 +95,19 @@ namespace osu.Game.Rulesets.Edit.Checks if (consequentDelay >= delay_threshold) yield return new IssueTemplateConsequentDelay(this).Create(file.Filename, consequentDelay); else if (consequentDelay + delay >= delay_threshold) - yield return new IssueTemplateDelay(this).Create(file.Filename, consequentDelay, delay); + { + if (consequentDelay > 0) + yield return new IssueTemplateDelay(this).Create(file.Filename, consequentDelay, delay); + else + yield return new IssueTemplateDelayNoSilence(this).Create(file.Filename, delay); + } else if (consequentDelay + delay >= delay_threshold_negligible) - yield return new IssuTemplateMinorDelay(this).Create(file.Filename, consequentDelay, delay); + { + if (consequentDelay > 0) + yield return new IssuTemplateMinorDelay(this).Create(file.Filename, consequentDelay, delay); + else + yield return new IssuTemplateMinorDelayNoSilence(this).Create(file.Filename, delay); + } } } } @@ -138,6 +150,17 @@ namespace osu.Game.Rulesets.Edit.Checks public Issue Create(string filename, int consequentDelay, int delay) => new Issue(this, filename, delay, consequentDelay); } + public class IssueTemplateDelayNoSilence : IssueTemplate + { + public IssueTemplateDelayNoSilence(ICheck check) + : base(check, IssueType.Warning, + "\"{0}\" has a transient delay of ~{1:0.##} ms.") + { + } + + public Issue Create(string filename, int delay) => new Issue(this, filename, delay); + } + public class IssuTemplateMinorDelay : IssueTemplate { public IssuTemplateMinorDelay(ICheck check) @@ -148,5 +171,16 @@ namespace osu.Game.Rulesets.Edit.Checks public Issue Create(string filename, int consequentDelay, int delay) => new Issue(this, filename, delay, consequentDelay); } + + public class IssuTemplateMinorDelayNoSilence : IssueTemplate + { + public IssuTemplateMinorDelayNoSilence(ICheck check) + : base(check, IssueType.Negligible, + "\"{0}\" has a transient delay of ~{1:0.##} ms.") + { + } + + public Issue Create(string filename, int delay) => new Issue(this, filename, delay); + } } }