Rename SwellSampleMapping -> DrumSampleMapping

This commit is contained in:
smoogipoo 2017-12-25 16:47:29 +09:00
parent 0fb620a8d3
commit 8bfdee586b
5 changed files with 47 additions and 41 deletions

View File

@ -0,0 +1,40 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Game.Audio;
using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Rulesets.Taiko.Audio
{
public class DrumSampleMapping : IComparable<DrumSampleMapping>
{
public double Time;
public readonly SampleInfo Centre;
public readonly SampleInfo Rim;
public SampleChannel CentreChannel { get; private set; }
public SampleChannel RimChannel { get; private set; }
public DrumSampleMapping()
{
}
public DrumSampleMapping(SampleControlPoint samplePoint)
{
Time = samplePoint.Time;
Centre = samplePoint.GetSampleInfo();
Rim = samplePoint.GetSampleInfo(SampleInfo.HIT_CLAP);
}
public void RetrieveChannels(AudioManager audio)
{
CentreChannel = Centre.GetChannel(audio.Sample);
RimChannel = Rim.GetChannel(audio.Sample);
}
public int CompareTo(DrumSampleMapping other) => Time.CompareTo(other.Time);
}
}

View File

@ -15,6 +15,7 @@
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Taiko.Judgements;
using osu.Framework.Audio;
using osu.Game.Rulesets.Taiko.Audio;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
@ -228,7 +229,7 @@ public override bool OnPressed(TaikoAction action)
// While the swell hasn't been fully judged, input is still blocked so it doesn't fall through to other hitobjects
// This causes the playfield to not play sounds, so they need to be handled locally
var mappingIndex = HitObject.ProgressionSamples.BinarySearch(new SwellSampleMapping { Time = Time.Current });
var mappingIndex = HitObject.ProgressionSamples.BinarySearch(new DrumSampleMapping { Time = Time.Current });
if (mappingIndex < 0)
mappingIndex = ~mappingIndex - 1;

View File

@ -7,6 +7,7 @@
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Taiko.Audio;
namespace osu.Game.Rulesets.Taiko.Objects
{
@ -21,25 +22,17 @@ public class Swell : TaikoHitObject, IHasEndTime
/// </summary>
public int RequiredHits = 10;
public List<SwellSampleMapping> ProgressionSamples = new List<SwellSampleMapping>();
public List<DrumSampleMapping> ProgressionSamples = new List<DrumSampleMapping>();
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
var progressionSamplePoints =
new[] { controlPointInfo.SamplePointAt(StartTime) }
var progressionSamplePoints = new[] { controlPointInfo.SamplePointAt(StartTime) }
.Concat(controlPointInfo.SamplePoints.Where(p => p.Time > StartTime && p.Time <= EndTime));
foreach (var point in progressionSamplePoints)
{
ProgressionSamples.Add(new SwellSampleMapping
{
Time = point.Time,
Centre = point.GetSampleInfo(),
Rim = point.GetSampleInfo(SampleInfo.HIT_CLAP)
});
}
ProgressionSamples.Add(new DrumSampleMapping(point));
}
}
}

View File

@ -1,28 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Game.Audio;
namespace osu.Game.Rulesets.Taiko.Objects
{
public class SwellSampleMapping : IComparable<SwellSampleMapping>
{
public double Time;
public SampleInfo Centre;
public SampleInfo Rim;
public SampleChannel CentreChannel { get; private set; }
public SampleChannel RimChannel { get; private set; }
public void RetrieveChannels(AudioManager audio)
{
CentreChannel = Centre.GetChannel(audio.Sample);
RimChannel = Rim.GetChannel(audio.Sample);
}
public int CompareTo(SwellSampleMapping other) => Time.CompareTo(other.Time);
}
}

View File

@ -44,6 +44,7 @@
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="Audio\DrumSampleMapping.cs" />
<Compile Include="Beatmaps\TaikoBeatmapConverter.cs" />
<Compile Include="Judgements\TaikoDrumRollTickJudgement.cs" />
<Compile Include="Judgements\TaikoStrongHitJudgement.cs" />
@ -74,7 +75,6 @@
<Compile Include="Objects\Hit.cs" />
<Compile Include="Objects\RimHit.cs" />
<Compile Include="Objects\Swell.cs" />
<Compile Include="Objects\SwellSampleMapping.cs" />
<Compile Include="Replays\TaikoFramedReplayInputHandler.cs" />
<Compile Include="Replays\TaikoAutoGenerator.cs" />
<Compile Include="Objects\TaikoHitObject.cs" />