From 5026c7a95e4dc653e556e6d6da129a312a973941 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 23 Dec 2017 16:31:45 +0900 Subject: [PATCH] SoundControlPoint -> SampleControlPoint --- .../Objects/Drawables/DrawableSlider.cs | 2 +- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 10 +++++----- .../Beatmaps/Formats/LegacyBeatmapDecoderTest.cs | 4 ++-- osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs | 2 +- osu.Game/Audio/SampleInfo.cs | 6 +++--- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 4 ++-- .../{SoundControlPoint.cs => SampleControlPoint.cs} | 2 +- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 6 +++--- .../Rulesets/Objects/Drawables/DrawableHitObject.cs | 8 ++++---- osu.Game/Rulesets/Objects/HitObject.cs | 6 +++--- .../Timelines/Summary/Parts/ControlPointPart.cs | 2 +- osu.Game/osu.Game.csproj | 2 +- 12 files changed, 27 insertions(+), 27 deletions(-) rename osu.Game/Beatmaps/ControlPoints/{SoundControlPoint.cs => SampleControlPoint.cs} (88%) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 57c1ffab00..befe84e3e9 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Scale = s.Scale, ComboColour = s.ComboColour, Samples = s.Samples, - SoundControlPoint = s.SoundControlPoint + SampleControlPoint = s.SampleControlPoint }) }; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 549c59cba1..864b0f0ca4 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -208,11 +208,11 @@ namespace osu.Game.Rulesets.Taiko.UI private void load(OsuColour colours, AudioManager audio) { allSamples = new Dictionary>(); - foreach (var soundPoint in controlPointInfo.SoundPoints) + foreach (var s in controlPointInfo.SamplePoints) { - var normalSample = SampleInfo.FromSoundPoint(soundPoint).GetChannel(audio.Sample); - var clapSample = SampleInfo.FromSoundPoint(soundPoint, SampleInfo.HIT_CLAP).GetChannel(audio.Sample); - allSamples.Add(soundPoint.Time, new Tuple(normalSample, clapSample)); + var normalSample = SampleInfo.FromSoundPoint(s).GetChannel(audio.Sample); + var clapSample = SampleInfo.FromSoundPoint(s, SampleInfo.HIT_CLAP).GetChannel(audio.Sample); + allSamples.Add(s.Time, new Tuple(normalSample, clapSample)); } overlayBackgroundContainer.BorderColour = colours.Gray0; @@ -281,7 +281,7 @@ namespace osu.Game.Rulesets.Taiko.UI public bool OnPressed(TaikoAction action) { var currentTime = Clock.CurrentTime; - var soundPoint = currentTime < controlPointInfo.SoundPoints[0].Time ? controlPointInfo.SoundPoints[0] : controlPointInfo.SoundPointAt(currentTime); + var soundPoint = currentTime < controlPointInfo.SamplePoints[0].Time ? controlPointInfo.SamplePoints[0] : controlPointInfo.SamplePointAt(currentTime); if (!allSamples.TryGetValue(soundPoint.Time, out Tuple samples)) throw new InvalidOperationException("Current sample set not found."); diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 86413af4b6..d3e7958ec1 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -146,8 +146,8 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.AreEqual(116999, difficultyPoint.Time); Assert.AreEqual(0.75000000000000189d, difficultyPoint.SpeedMultiplier); - Assert.AreEqual(34, controlPoints.SoundPoints.Count); - var soundPoint = controlPoints.SoundPoints[0]; + Assert.AreEqual(34, controlPoints.SamplePoints.Count); + var soundPoint = controlPoints.SamplePoints[0]; Assert.AreEqual(956, soundPoint.Time); Assert.AreEqual("soft", soundPoint.SampleBank); Assert.AreEqual(60, soundPoint.SampleVolume); diff --git a/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs b/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs index 01371ad78c..ef7404ad49 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs +++ b/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs @@ -56,7 +56,7 @@ namespace osu.Game.Tests.Visual b.ControlPointInfo.EffectPoints.Add(new EffectControlPoint { Time = random.Next(0, length) }); for (int i = 0; i < random.Next(1, 5); i++) - b.ControlPointInfo.SoundPoints.Add(new SoundControlPoint { Time = random.Next(0, length) }); + b.ControlPointInfo.SamplePoints.Add(new SampleControlPoint { Time = random.Next(0, length) }); b.BeatmapInfo.Bookmarks = new int[random.Next(10, 30)]; for (int i = 0; i < b.BeatmapInfo.Bookmarks.Length; i++) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 3003339ca2..6a95721bd0 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -17,13 +17,13 @@ namespace osu.Game.Audio public const string HIT_NORMAL = @"hitnormal"; public const string HIT_CLAP = @"hitclap"; - public static SampleInfo FromSoundPoint(SoundControlPoint soundPoint, string sampleName = HIT_NORMAL) + public static SampleInfo FromSoundPoint(SampleControlPoint samplePoint, string sampleName = HIT_NORMAL) { return new SampleInfo { - Bank = soundPoint.SampleBank, + Bank = samplePoint.SampleBank, Name = sampleName, - Volume = soundPoint.SampleVolume, + Volume = samplePoint.SampleVolume, }; } diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 64b9b837b6..e8ec6595bd 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -28,7 +28,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// All sound points. /// [JsonProperty] - public SortedList SoundPoints { get; private set; } = new SortedList(Comparer.Default); + public SortedList SamplePoints { get; private set; } = new SortedList(Comparer.Default); /// /// All effect points. @@ -55,7 +55,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the sound control point at. /// The sound control point. - public SoundControlPoint SoundPointAt(double time) => binarySearch(SoundPoints, time); + public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time); /// /// Finds the timing control point that is active at . diff --git a/osu.Game/Beatmaps/ControlPoints/SoundControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs similarity index 88% rename from osu.Game/Beatmaps/ControlPoints/SoundControlPoint.cs rename to osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index b73a03b95a..e3d6eede44 100644 --- a/osu.Game/Beatmaps/ControlPoints/SoundControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -3,7 +3,7 @@ namespace osu.Game.Beatmaps.ControlPoints { - public class SoundControlPoint : ControlPoint + public class SampleControlPoint : ControlPoint { public const string DEFAULT_BANK = "normal"; diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index b7004dd3eb..ea29e480ec 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -313,7 +313,7 @@ namespace osu.Game.Beatmaps.Formats stringSampleSet = @"normal"; DifficultyControlPoint difficultyPoint = beatmap.ControlPointInfo.DifficultyPointAt(time); - SoundControlPoint soundPoint = beatmap.ControlPointInfo.SoundPointAt(time); + SampleControlPoint samplePoint = beatmap.ControlPointInfo.SamplePointAt(time); EffectControlPoint effectPoint = beatmap.ControlPointInfo.EffectPointAt(time); if (timingChange) @@ -336,9 +336,9 @@ namespace osu.Game.Beatmaps.Formats }); } - if (stringSampleSet != soundPoint.SampleBank || sampleVolume != soundPoint.SampleVolume) + if (stringSampleSet != samplePoint.SampleBank || sampleVolume != samplePoint.SampleVolume) { - beatmap.ControlPointInfo.SoundPoints.Add(new SoundControlPoint + beatmap.ControlPointInfo.SamplePoints.Add(new SampleControlPoint { Time = time, SampleBank = stringSampleSet, diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 4f5f8898f8..8cfdda0413 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -86,16 +86,16 @@ namespace osu.Game.Rulesets.Objects.Drawables { foreach (SampleInfo sample in HitObject.Samples) { - if (HitObject.SoundControlPoint == null) - throw new ArgumentNullException(nameof(HitObject.SoundControlPoint), $"{nameof(HitObject)} must always have an attached {nameof(HitObject.SoundControlPoint)}."); + if (HitObject.SampleControlPoint == null) + throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)} must always have an attached {nameof(HitObject.SampleControlPoint)}."); var bank = sample.Bank; if (string.IsNullOrEmpty(bank)) - bank = HitObject.SoundControlPoint.SampleBank; + bank = HitObject.SampleControlPoint.SampleBank; int volume = sample.Volume; if (volume == 0) - volume = HitObject.SoundControlPoint.SampleVolume; + volume = HitObject.SampleControlPoint.SampleVolume; SampleChannel channel = audio.Sample.Get($@"Gameplay/{bank}-{sample.Name}"); diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 9e331dfea9..5ecba7456e 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Objects public SampleInfoList Samples = new SampleInfoList(); [JsonIgnore] - public SoundControlPoint SoundControlPoint; + public SampleControlPoint SampleControlPoint; /// /// Whether this is in Kiai time. @@ -64,11 +64,11 @@ namespace osu.Game.Rulesets.Objects protected virtual void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) { - SoundControlPoint soundPoint = controlPointInfo.SoundPointAt(StartTime); + SampleControlPoint samplePoint = controlPointInfo.SamplePointAt(StartTime); EffectControlPoint effectPoint = controlPointInfo.EffectPointAt(StartTime); Kiai = effectPoint.KiaiMode; - SoundControlPoint = soundPoint; + SampleControlPoint = samplePoint; } protected virtual void CreateNestedHitObjects() diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs index 405befb80a..3759470c9a 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts cpi.TimingPoints.ForEach(addTimingPoint); // Consider all non-timing points as the same type - cpi.SoundPoints.Select(c => (ControlPoint)c) + cpi.SamplePoints.Select(c => (ControlPoint)c) .Concat(cpi.EffectPoints) .Concat(cpi.DifficultyPoints) .Distinct() diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index e78d10cc4f..f9e67623a3 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -258,7 +258,7 @@ - +