1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:07:52 +08:00

Add back required pieces to GameplaySampleTriggerSource from old PR

This commit is contained in:
Dean Herbert 2023-06-30 16:13:32 +09:00
parent f54eb8d7fa
commit 6d4fa6569f

View File

@ -34,14 +34,19 @@ namespace osu.Game.Rulesets.UI
[Resolved]
private IGameplayClock? gameplayClock { get; set; }
protected readonly AudioContainer AudioContainer;
public GameplaySampleTriggerSource(HitObjectContainer hitObjectContainer)
{
this.hitObjectContainer = hitObjectContainer;
InternalChild = hitSounds = new Container<SkinnableSound>
InternalChild = AudioContainer = new AudioContainer
{
Name = "concurrent sample pool",
ChildrenEnumerable = Enumerable.Range(0, max_concurrent_hitsounds).Select(_ => new PausableSkinnableSound())
Child = hitSounds = new Container<SkinnableSound>
{
Name = "concurrent sample pool",
ChildrenEnumerable = Enumerable.Range(0, max_concurrent_hitsounds).Select(_ => new PausableSkinnableSound())
}
};
}
@ -64,11 +69,22 @@ namespace osu.Game.Rulesets.UI
protected virtual void PlaySamples(ISampleInfo[] samples) => Schedule(() =>
{
var hitSound = getNextSample();
hitSound.Samples = samples;
var hitSound = GetNextSample();
ApplySampleInfo(hitSound, samples);
hitSound.Play();
});
protected virtual void ApplySampleInfo(SkinnableSound hitSound, ISampleInfo[] samples)
{
hitSound.Samples = samples;
}
public void StopAllPlayback() => Schedule(() =>
{
foreach (var sound in hitSounds)
sound.Stop();
});
protected HitObject? GetMostValidObject()
{
if (mostValidObject == null || isAlreadyHit(mostValidObject))