diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTargetPractice.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTargetPractice.cs
index a5846efdfe..72422a0ae8 100644
--- a/osu.Game.Rulesets.Osu/Mods/OsuModTargetPractice.cs
+++ b/osu.Game.Rulesets.Osu/Mods/OsuModTargetPractice.cs
@@ -230,7 +230,7 @@ namespace osu.Game.Rulesets.Osu.Mods
// If samples aren't available at the exact start time of the object,
// use samples (without additions) in the closest original hit object instead
- obj.Samples = samples ?? getClosestHitObject(originalHitObjects, obj.StartTime).Samples.Where(s => !HitSampleInfo.AllAdditions.Contains(s.Name)).ToList();
+ obj.Samples = samples ?? getClosestHitObject(originalHitObjects, obj.StartTime).Samples.Where(s => !HitSampleInfo.ALL_ADDITIONS.Contains(s.Name)).ToList();
}
}
diff --git a/osu.Game/Audio/HitSampleInfo.cs b/osu.Game/Audio/HitSampleInfo.cs
index 19273e3714..5a7c28d024 100644
--- a/osu.Game/Audio/HitSampleInfo.cs
+++ b/osu.Game/Audio/HitSampleInfo.cs
@@ -33,12 +33,12 @@ namespace osu.Game.Audio
///
/// All valid sample addition constants.
///
- public static IEnumerable AllAdditions => new[] { HIT_WHISTLE, HIT_FINISH, HIT_CLAP };
+ public static readonly string[] ALL_ADDITIONS = [HIT_WHISTLE, HIT_FINISH, HIT_CLAP];
///
/// All valid bank constants.
///
- public static IEnumerable AllBanks => new[] { BANK_NORMAL, BANK_SOFT, BANK_DRUM };
+ public static readonly string[] ALL_BANKS = [BANK_NORMAL, BANK_SOFT, BANK_DRUM];
///
/// The name of the sample to load.
diff --git a/osu.Game/Rulesets/Edit/Checks/CheckDelayedHitsounds.cs b/osu.Game/Rulesets/Edit/Checks/CheckDelayedHitsounds.cs
index d6cd4f4caa..ee950248db 100644
--- a/osu.Game/Rulesets/Edit/Checks/CheckDelayedHitsounds.cs
+++ b/osu.Game/Rulesets/Edit/Checks/CheckDelayedHitsounds.cs
@@ -119,8 +119,8 @@ namespace osu.Game.Rulesets.Edit.Checks
string bank = parts[0];
string sampleSet = parts[1];
- return HitSampleInfo.AllBanks.Contains(bank)
- && HitSampleInfo.AllAdditions.Append(HitSampleInfo.HIT_NORMAL).Any(sampleSet.StartsWith);
+ return HitSampleInfo.ALL_BANKS.Contains(bank)
+ && HitSampleInfo.ALL_ADDITIONS.Append(HitSampleInfo.HIT_NORMAL).Any(sampleSet.StartsWith);
}
public class IssueTemplateConsequentDelay : IssueTemplate
diff --git a/osu.Game/Rulesets/Edit/Checks/CheckFewHitsounds.cs b/osu.Game/Rulesets/Edit/Checks/CheckFewHitsounds.cs
index 3358e81d5f..97c1519c24 100644
--- a/osu.Game/Rulesets/Edit/Checks/CheckFewHitsounds.cs
+++ b/osu.Game/Rulesets/Edit/Checks/CheckFewHitsounds.cs
@@ -114,7 +114,7 @@ namespace osu.Game.Rulesets.Edit.Checks
++objectsWithoutHitsounds;
}
- private bool isHitsound(HitSampleInfo sample) => HitSampleInfo.AllAdditions.Any(sample.Name.Contains);
+ private bool isHitsound(HitSampleInfo sample) => HitSampleInfo.ALL_ADDITIONS.Any(sample.Name.Contains);
private bool isHitnormal(HitSampleInfo sample) => sample.Name.Contains(HitSampleInfo.HIT_NORMAL);
public abstract class IssueTemplateLongPeriod : IssueTemplate
diff --git a/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs b/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs
index 78cee2c1cf..cd6e25734a 100644
--- a/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/EditorSelectionHandler.cs
@@ -79,7 +79,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
///
private void createStateBindables()
{
- foreach (string bankName in HitSampleInfo.AllBanks.Prepend(HIT_BANK_AUTO))
+ foreach (string bankName in HitSampleInfo.ALL_BANKS.Prepend(HIT_BANK_AUTO))
{
var bindable = new Bindable
{
@@ -143,7 +143,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
SelectionBankStates[bankName] = bindable;
}
- foreach (string bankName in HitSampleInfo.AllBanks.Prepend(HIT_BANK_AUTO))
+ foreach (string bankName in HitSampleInfo.ALL_BANKS.Prepend(HIT_BANK_AUTO))
{
var bindable = new Bindable
{
@@ -216,7 +216,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
resetTernaryStates();
- foreach (string sampleName in HitSampleInfo.AllAdditions)
+ foreach (string sampleName in HitSampleInfo.ALL_ADDITIONS)
{
var bindable = new Bindable
{
diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs
index c3a56c8df9..4ca3f93f13 100644
--- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs
@@ -409,7 +409,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private void createStateBindables()
{
- foreach (string sampleName in HitSampleInfo.AllAdditions)
+ foreach (string sampleName in HitSampleInfo.ALL_ADDITIONS)
{
var bindable = new Bindable
{
@@ -433,7 +433,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
selectionSampleStates[sampleName] = bindable;
}
- banks.AddRange(HitSampleInfo.AllBanks.Prepend(EditorSelectionHandler.HIT_BANK_AUTO));
+ banks.AddRange(HitSampleInfo.ALL_BANKS.Prepend(EditorSelectionHandler.HIT_BANK_AUTO));
}
private void updateTernaryStates()
diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs
index 578e945c64..2b5667ff9c 100644
--- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBlueprintContainer.cs
@@ -155,9 +155,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
if (hitObject.GetEndTime() < editorClock.CurrentTime - timeline.VisibleRange / 2)
break;
- foreach (var sample in hitObject.Samples)
+ for (int i = 0; i < hitObject.Samples.Count; i++)
{
- if (!HitSampleInfo.AllBanks.Contains(sample.Bank))
+ var sample = hitObject.Samples[i];
+
+ if (!HitSampleInfo.ALL_BANKS.Contains(sample.Bank))
minimumGap = Math.Max(minimumGap, absolute_minimum_gap + sample.Bank.Length * 3);
}
@@ -165,10 +167,17 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
smallestTimeGap = Math.Min(smallestTimeGap, hasRepeats.Duration / hasRepeats.SpanCount() / 2);
- foreach (var sample in hasRepeats.NodeSamples.SelectMany(s => s))
+ for (int i = 0; i < hasRepeats.NodeSamples.Count; i++)
{
- if (!HitSampleInfo.AllBanks.Contains(sample.Bank))
- minimumGap = Math.Max(minimumGap, absolute_minimum_gap + sample.Bank.Length * 3);
+ var node = hasRepeats.NodeSamples[i];
+
+ for (int j = 0; j < node.Count; j++)
+ {
+ var sample = node[j];
+
+ if (!HitSampleInfo.ALL_BANKS.Contains(sample.Bank))
+ minimumGap = Math.Max(minimumGap, absolute_minimum_gap + sample.Bank.Length * 3);
+ }
}
}