mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Add back required pieces to GameplaySampleTriggerSource
from old PR
This commit is contained in:
parent
f54eb8d7fa
commit
6d4fa6569f
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user