1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 15:12:57 +08:00

SoundControlPoint -> SampleControlPoint

This commit is contained in:
Dean Herbert 2017-12-23 16:31:45 +09:00
parent ff0927e71b
commit 5026c7a95e
12 changed files with 27 additions and 27 deletions

View File

@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Scale = s.Scale, Scale = s.Scale,
ComboColour = s.ComboColour, ComboColour = s.ComboColour,
Samples = s.Samples, Samples = s.Samples,
SoundControlPoint = s.SoundControlPoint SampleControlPoint = s.SampleControlPoint
}) })
}; };

View File

@ -208,11 +208,11 @@ namespace osu.Game.Rulesets.Taiko.UI
private void load(OsuColour colours, AudioManager audio) private void load(OsuColour colours, AudioManager audio)
{ {
allSamples = new Dictionary<double, Tuple<SampleChannel, SampleChannel>>(); allSamples = new Dictionary<double, Tuple<SampleChannel, SampleChannel>>();
foreach (var soundPoint in controlPointInfo.SoundPoints) foreach (var s in controlPointInfo.SamplePoints)
{ {
var normalSample = SampleInfo.FromSoundPoint(soundPoint).GetChannel(audio.Sample); var normalSample = SampleInfo.FromSoundPoint(s).GetChannel(audio.Sample);
var clapSample = SampleInfo.FromSoundPoint(soundPoint, SampleInfo.HIT_CLAP).GetChannel(audio.Sample); var clapSample = SampleInfo.FromSoundPoint(s, SampleInfo.HIT_CLAP).GetChannel(audio.Sample);
allSamples.Add(soundPoint.Time, new Tuple<SampleChannel, SampleChannel>(normalSample, clapSample)); allSamples.Add(s.Time, new Tuple<SampleChannel, SampleChannel>(normalSample, clapSample));
} }
overlayBackgroundContainer.BorderColour = colours.Gray0; overlayBackgroundContainer.BorderColour = colours.Gray0;
@ -281,7 +281,7 @@ namespace osu.Game.Rulesets.Taiko.UI
public bool OnPressed(TaikoAction action) public bool OnPressed(TaikoAction action)
{ {
var currentTime = Clock.CurrentTime; 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<SampleChannel, SampleChannel> samples)) if (!allSamples.TryGetValue(soundPoint.Time, out Tuple<SampleChannel, SampleChannel> samples))
throw new InvalidOperationException("Current sample set not found."); throw new InvalidOperationException("Current sample set not found.");

View File

@ -146,8 +146,8 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.AreEqual(116999, difficultyPoint.Time); Assert.AreEqual(116999, difficultyPoint.Time);
Assert.AreEqual(0.75000000000000189d, difficultyPoint.SpeedMultiplier); Assert.AreEqual(0.75000000000000189d, difficultyPoint.SpeedMultiplier);
Assert.AreEqual(34, controlPoints.SoundPoints.Count); Assert.AreEqual(34, controlPoints.SamplePoints.Count);
var soundPoint = controlPoints.SoundPoints[0]; var soundPoint = controlPoints.SamplePoints[0];
Assert.AreEqual(956, soundPoint.Time); Assert.AreEqual(956, soundPoint.Time);
Assert.AreEqual("soft", soundPoint.SampleBank); Assert.AreEqual("soft", soundPoint.SampleBank);
Assert.AreEqual(60, soundPoint.SampleVolume); Assert.AreEqual(60, soundPoint.SampleVolume);

View File

@ -56,7 +56,7 @@ namespace osu.Game.Tests.Visual
b.ControlPointInfo.EffectPoints.Add(new EffectControlPoint { Time = random.Next(0, length) }); b.ControlPointInfo.EffectPoints.Add(new EffectControlPoint { Time = random.Next(0, length) });
for (int i = 0; i < random.Next(1, 5); i++) 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)]; b.BeatmapInfo.Bookmarks = new int[random.Next(10, 30)];
for (int i = 0; i < b.BeatmapInfo.Bookmarks.Length; i++) for (int i = 0; i < b.BeatmapInfo.Bookmarks.Length; i++)

View File

@ -17,13 +17,13 @@ namespace osu.Game.Audio
public const string HIT_NORMAL = @"hitnormal"; public const string HIT_NORMAL = @"hitnormal";
public const string HIT_CLAP = @"hitclap"; 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 return new SampleInfo
{ {
Bank = soundPoint.SampleBank, Bank = samplePoint.SampleBank,
Name = sampleName, Name = sampleName,
Volume = soundPoint.SampleVolume, Volume = samplePoint.SampleVolume,
}; };
} }

View File

@ -28,7 +28,7 @@ namespace osu.Game.Beatmaps.ControlPoints
/// All sound points. /// All sound points.
/// </summary> /// </summary>
[JsonProperty] [JsonProperty]
public SortedList<SoundControlPoint> SoundPoints { get; private set; } = new SortedList<SoundControlPoint>(Comparer<SoundControlPoint>.Default); public SortedList<SampleControlPoint> SamplePoints { get; private set; } = new SortedList<SampleControlPoint>(Comparer<SampleControlPoint>.Default);
/// <summary> /// <summary>
/// All effect points. /// All effect points.
@ -55,7 +55,7 @@ namespace osu.Game.Beatmaps.ControlPoints
/// </summary> /// </summary>
/// <param name="time">The time to find the sound control point at.</param> /// <param name="time">The time to find the sound control point at.</param>
/// <returns>The sound control point.</returns> /// <returns>The sound control point.</returns>
public SoundControlPoint SoundPointAt(double time) => binarySearch(SoundPoints, time); public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time);
/// <summary> /// <summary>
/// Finds the timing control point that is active at <paramref name="time"/>. /// Finds the timing control point that is active at <paramref name="time"/>.

View File

@ -3,7 +3,7 @@
namespace osu.Game.Beatmaps.ControlPoints namespace osu.Game.Beatmaps.ControlPoints
{ {
public class SoundControlPoint : ControlPoint public class SampleControlPoint : ControlPoint
{ {
public const string DEFAULT_BANK = "normal"; public const string DEFAULT_BANK = "normal";

View File

@ -313,7 +313,7 @@ namespace osu.Game.Beatmaps.Formats
stringSampleSet = @"normal"; stringSampleSet = @"normal";
DifficultyControlPoint difficultyPoint = beatmap.ControlPointInfo.DifficultyPointAt(time); DifficultyControlPoint difficultyPoint = beatmap.ControlPointInfo.DifficultyPointAt(time);
SoundControlPoint soundPoint = beatmap.ControlPointInfo.SoundPointAt(time); SampleControlPoint samplePoint = beatmap.ControlPointInfo.SamplePointAt(time);
EffectControlPoint effectPoint = beatmap.ControlPointInfo.EffectPointAt(time); EffectControlPoint effectPoint = beatmap.ControlPointInfo.EffectPointAt(time);
if (timingChange) 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, Time = time,
SampleBank = stringSampleSet, SampleBank = stringSampleSet,

View File

@ -86,16 +86,16 @@ namespace osu.Game.Rulesets.Objects.Drawables
{ {
foreach (SampleInfo sample in HitObject.Samples) foreach (SampleInfo sample in HitObject.Samples)
{ {
if (HitObject.SoundControlPoint == null) if (HitObject.SampleControlPoint == null)
throw new ArgumentNullException(nameof(HitObject.SoundControlPoint), $"{nameof(HitObject)} must always have an attached {nameof(HitObject.SoundControlPoint)}."); throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)} must always have an attached {nameof(HitObject.SampleControlPoint)}.");
var bank = sample.Bank; var bank = sample.Bank;
if (string.IsNullOrEmpty(bank)) if (string.IsNullOrEmpty(bank))
bank = HitObject.SoundControlPoint.SampleBank; bank = HitObject.SampleControlPoint.SampleBank;
int volume = sample.Volume; int volume = sample.Volume;
if (volume == 0) if (volume == 0)
volume = HitObject.SoundControlPoint.SampleVolume; volume = HitObject.SampleControlPoint.SampleVolume;
SampleChannel channel = audio.Sample.Get($@"Gameplay/{bank}-{sample.Name}"); SampleChannel channel = audio.Sample.Get($@"Gameplay/{bank}-{sample.Name}");

View File

@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Objects
public SampleInfoList Samples = new SampleInfoList(); public SampleInfoList Samples = new SampleInfoList();
[JsonIgnore] [JsonIgnore]
public SoundControlPoint SoundControlPoint; public SampleControlPoint SampleControlPoint;
/// <summary> /// <summary>
/// Whether this <see cref="HitObject"/> is in Kiai time. /// Whether this <see cref="HitObject"/> is in Kiai time.
@ -64,11 +64,11 @@ namespace osu.Game.Rulesets.Objects
protected virtual void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) protected virtual void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{ {
SoundControlPoint soundPoint = controlPointInfo.SoundPointAt(StartTime); SampleControlPoint samplePoint = controlPointInfo.SamplePointAt(StartTime);
EffectControlPoint effectPoint = controlPointInfo.EffectPointAt(StartTime); EffectControlPoint effectPoint = controlPointInfo.EffectPointAt(StartTime);
Kiai = effectPoint.KiaiMode; Kiai = effectPoint.KiaiMode;
SoundControlPoint = soundPoint; SampleControlPoint = samplePoint;
} }
protected virtual void CreateNestedHitObjects() protected virtual void CreateNestedHitObjects()

View File

@ -25,7 +25,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
cpi.TimingPoints.ForEach(addTimingPoint); cpi.TimingPoints.ForEach(addTimingPoint);
// Consider all non-timing points as the same type // 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.EffectPoints)
.Concat(cpi.DifficultyPoints) .Concat(cpi.DifficultyPoints)
.Distinct() .Distinct()

View File

@ -258,7 +258,7 @@
<Compile Include="Beatmaps\ControlPoints\ControlPointInfo.cs" /> <Compile Include="Beatmaps\ControlPoints\ControlPointInfo.cs" />
<Compile Include="Beatmaps\ControlPoints\DifficultyControlPoint.cs" /> <Compile Include="Beatmaps\ControlPoints\DifficultyControlPoint.cs" />
<Compile Include="Beatmaps\ControlPoints\EffectControlPoint.cs" /> <Compile Include="Beatmaps\ControlPoints\EffectControlPoint.cs" />
<Compile Include="Beatmaps\ControlPoints\SoundControlPoint.cs" /> <Compile Include="Beatmaps\ControlPoints\SampleControlPoint.cs" />
<Compile Include="Beatmaps\ControlPoints\TimingControlPoint.cs" /> <Compile Include="Beatmaps\ControlPoints\TimingControlPoint.cs" />
<Compile Include="Beatmaps\DifficultyCalculator.cs" /> <Compile Include="Beatmaps\DifficultyCalculator.cs" />
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" /> <Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />