mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 00:02:54 +08:00
SoundControlPoint -> SampleControlPoint
This commit is contained in:
parent
ff0927e71b
commit
5026c7a95e
@ -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
|
||||
})
|
||||
};
|
||||
|
||||
|
@ -208,11 +208,11 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
private void load(OsuColour colours, AudioManager audio)
|
||||
{
|
||||
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 clapSample = SampleInfo.FromSoundPoint(soundPoint, SampleInfo.HIT_CLAP).GetChannel(audio.Sample);
|
||||
allSamples.Add(soundPoint.Time, new Tuple<SampleChannel, SampleChannel>(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<SampleChannel, SampleChannel>(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<SampleChannel, SampleChannel> samples))
|
||||
throw new InvalidOperationException("Current sample set not found.");
|
||||
|
@ -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);
|
||||
|
@ -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++)
|
||||
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
/// All sound points.
|
||||
/// </summary>
|
||||
[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>
|
||||
/// All effect points.
|
||||
@ -55,7 +55,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
/// </summary>
|
||||
/// <param name="time">The time to find the sound control point at.</param>
|
||||
/// <returns>The sound control point.</returns>
|
||||
public SoundControlPoint SoundPointAt(double time) => binarySearch(SoundPoints, time);
|
||||
public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time);
|
||||
|
||||
/// <summary>
|
||||
/// Finds the timing control point that is active at <paramref name="time"/>.
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
namespace osu.Game.Beatmaps.ControlPoints
|
||||
{
|
||||
public class SoundControlPoint : ControlPoint
|
||||
public class SampleControlPoint : ControlPoint
|
||||
{
|
||||
public const string DEFAULT_BANK = "normal";
|
||||
|
@ -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,
|
||||
|
@ -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}");
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
public SampleInfoList Samples = new SampleInfoList();
|
||||
|
||||
[JsonIgnore]
|
||||
public SoundControlPoint SoundControlPoint;
|
||||
public SampleControlPoint SampleControlPoint;
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
{
|
||||
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()
|
||||
|
@ -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()
|
||||
|
@ -258,7 +258,7 @@
|
||||
<Compile Include="Beatmaps\ControlPoints\ControlPointInfo.cs" />
|
||||
<Compile Include="Beatmaps\ControlPoints\DifficultyControlPoint.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\DifficultyCalculator.cs" />
|
||||
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user