mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 15:27:30 +08:00
Move VolumeAwareHitSampleInfo
to own file
This commit is contained in:
parent
48f27ff340
commit
6bfbcca2fd
@ -15,9 +15,9 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Argon
|
||||
private void load(IPooledSampleProvider sampleProvider)
|
||||
{
|
||||
// Warm up pools for non-standard samples.
|
||||
sampleProvider.GetPooledSample(new ArgonDrumSampleTriggerSource.VolumeAwareHitSampleInfo(new HitSampleInfo(HitSampleInfo.HIT_NORMAL), true));
|
||||
sampleProvider.GetPooledSample(new ArgonDrumSampleTriggerSource.VolumeAwareHitSampleInfo(new HitSampleInfo(HitSampleInfo.HIT_CLAP), true));
|
||||
sampleProvider.GetPooledSample(new ArgonDrumSampleTriggerSource.VolumeAwareHitSampleInfo(new HitSampleInfo(HitSampleInfo.HIT_FLOURISH), true));
|
||||
sampleProvider.GetPooledSample(new VolumeAwareHitSampleInfo(new HitSampleInfo(HitSampleInfo.HIT_NORMAL), true));
|
||||
sampleProvider.GetPooledSample(new VolumeAwareHitSampleInfo(new HitSampleInfo(HitSampleInfo.HIT_CLAP), true));
|
||||
sampleProvider.GetPooledSample(new VolumeAwareHitSampleInfo(new HitSampleInfo(HitSampleInfo.HIT_FLOURISH), true));
|
||||
}
|
||||
|
||||
protected override DrumSampleTriggerSource CreateTriggerSource(HitObjectContainer hitObjectContainer, SampleBalance balance) =>
|
||||
|
@ -81,49 +81,5 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Argon
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public class VolumeAwareHitSampleInfo : HitSampleInfo
|
||||
{
|
||||
public const int SAMPLE_VOLUME_THRESHOLD_HARD = 90;
|
||||
public const int SAMPLE_VOLUME_THRESHOLD_MEDIUM = 60;
|
||||
|
||||
public VolumeAwareHitSampleInfo(HitSampleInfo sampleInfo, bool isStrong = false)
|
||||
: base(sampleInfo.Name, isStrong ? BANK_STRONG : getBank(sampleInfo.Bank, sampleInfo.Name, sampleInfo.Volume), sampleInfo.Suffix, sampleInfo.Volume)
|
||||
{
|
||||
}
|
||||
|
||||
public override IEnumerable<string> LookupNames
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (string name in base.LookupNames)
|
||||
yield return name.Insert(name.LastIndexOf('/') + 1, "Argon/taiko-");
|
||||
}
|
||||
}
|
||||
|
||||
private static string getBank(string originalBank, string sampleName, int volume)
|
||||
{
|
||||
// So basically we're overwriting mapper's bank intentions here.
|
||||
// The rationale is that most taiko beatmaps only use a single bank, but regularly adjust volume.
|
||||
|
||||
switch (sampleName)
|
||||
{
|
||||
case HIT_NORMAL:
|
||||
case HIT_CLAP:
|
||||
{
|
||||
if (volume >= SAMPLE_VOLUME_THRESHOLD_HARD)
|
||||
return BANK_DRUM;
|
||||
|
||||
if (volume >= SAMPLE_VOLUME_THRESHOLD_MEDIUM)
|
||||
return BANK_NORMAL;
|
||||
|
||||
return BANK_SOFT;
|
||||
}
|
||||
|
||||
default:
|
||||
return originalBank;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Audio;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Skinning.Argon
|
||||
{
|
||||
public class VolumeAwareHitSampleInfo : HitSampleInfo
|
||||
{
|
||||
public const int SAMPLE_VOLUME_THRESHOLD_HARD = 90;
|
||||
public const int SAMPLE_VOLUME_THRESHOLD_MEDIUM = 60;
|
||||
|
||||
public VolumeAwareHitSampleInfo(HitSampleInfo sampleInfo, bool isStrong = false)
|
||||
: base(sampleInfo.Name, isStrong ? BANK_STRONG : getBank(sampleInfo.Bank, sampleInfo.Name, sampleInfo.Volume), sampleInfo.Suffix, sampleInfo.Volume)
|
||||
{
|
||||
}
|
||||
|
||||
public override IEnumerable<string> LookupNames
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (string name in base.LookupNames)
|
||||
yield return name.Insert(name.LastIndexOf('/') + 1, "Argon/taiko-");
|
||||
}
|
||||
}
|
||||
|
||||
private static string getBank(string originalBank, string sampleName, int volume)
|
||||
{
|
||||
// So basically we're overwriting mapper's bank intentions here.
|
||||
// The rationale is that most taiko beatmaps only use a single bank, but regularly adjust volume.
|
||||
|
||||
switch (sampleName)
|
||||
{
|
||||
case HIT_NORMAL:
|
||||
case HIT_CLAP:
|
||||
{
|
||||
if (volume >= SAMPLE_VOLUME_THRESHOLD_HARD)
|
||||
return BANK_DRUM;
|
||||
|
||||
if (volume >= SAMPLE_VOLUME_THRESHOLD_MEDIUM)
|
||||
return BANK_NORMAL;
|
||||
|
||||
return BANK_SOFT;
|
||||
}
|
||||
|
||||
default:
|
||||
return originalBank;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user