mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 03:25:11 +08:00
style: use more rigorous hitsound filtering
This commit is contained in:
parent
f05659a1c0
commit
4c32e9a479
@ -23,7 +23,8 @@ namespace osu.Game.Rulesets.Edit.Checks
|
||||
private const int delay_threshold_negligible = 1;
|
||||
|
||||
private readonly string[] audioExtensions = { "mp3", "ogg", "wav" };
|
||||
private readonly string[] sampleBankPrefixes = { HitSampleInfo.BANK_NORMAL, HitSampleInfo.BANK_SOFT, HitSampleInfo.BANK_DRUM };
|
||||
private readonly string[] bankNames = { HitSampleInfo.BANK_NORMAL, HitSampleInfo.BANK_SOFT, HitSampleInfo.BANK_DRUM };
|
||||
private readonly string[] sampleSets = { HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_WHISTLE, HitSampleInfo.HIT_FINISH, HitSampleInfo.HIT_CLAP };
|
||||
|
||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Audio, "Delayed hit sounds.");
|
||||
|
||||
@ -100,7 +101,20 @@ namespace osu.Game.Rulesets.Edit.Checks
|
||||
}
|
||||
|
||||
private bool hasAudioExtension(string filename) => audioExtensions.Any(filename.ToLowerInvariant().EndsWith);
|
||||
private bool isHitSound(string filename) => sampleBankPrefixes.Select(p => p + "-").Any(filename.ToLowerInvariant().StartsWith);
|
||||
|
||||
private bool isHitSound(string filename)
|
||||
{
|
||||
// <bank>-<sampleset>
|
||||
string[] parts = filename.ToLowerInvariant().Split('-');
|
||||
|
||||
if (parts.Length != 2)
|
||||
return false;
|
||||
|
||||
string bank = parts[0];
|
||||
string sampleSet = parts[1];
|
||||
|
||||
return bankNames.Contains(bank) && sampleSets.Any(sampleSet.StartsWith);
|
||||
}
|
||||
|
||||
public class IssueTemplateConsequentDelay : IssueTemplate
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user