mirror of https://github.com/ppy/osu
Add adjustments on channel creation if there is
This commit is contained in:
parent
3d62003382
commit
ec6a40af33
|
@ -15,6 +15,9 @@ namespace osu.Game.Skinning
|
||||||
public class SkinnableSound : SkinReloadableDrawable
|
public class SkinnableSound : SkinReloadableDrawable
|
||||||
{
|
{
|
||||||
private readonly ISampleInfo[] hitSamples;
|
private readonly ISampleInfo[] hitSamples;
|
||||||
|
|
||||||
|
private readonly List<(AdjustableProperty, BindableDouble)> adjustments = new List<(AdjustableProperty, BindableDouble)>();
|
||||||
|
|
||||||
private SampleChannel[] channels;
|
private SampleChannel[] channels;
|
||||||
|
|
||||||
private AudioManager audio;
|
private AudioManager audio;
|
||||||
|
@ -51,8 +54,17 @@ public bool Looping
|
||||||
public void Play() => channels?.ForEach(c => c.Play());
|
public void Play() => channels?.ForEach(c => c.Play());
|
||||||
public void Stop() => channels?.ForEach(c => c.Stop());
|
public void Stop() => channels?.ForEach(c => c.Stop());
|
||||||
|
|
||||||
public void AddAdjustment(AdjustableProperty type, BindableDouble adjustBindable) => channels?.ForEach(c => c.AddAdjustment(type, adjustBindable));
|
public void AddAdjustment(AdjustableProperty type, BindableDouble adjustBindable)
|
||||||
public void RemoveAdjustment(AdjustableProperty type, BindableDouble adjustBindable) => channels?.ForEach(c => c.RemoveAdjustment(type, adjustBindable));
|
{
|
||||||
|
adjustments.Add((type, adjustBindable));
|
||||||
|
channels?.ForEach(c => c.AddAdjustment(type, adjustBindable));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveAdjustment(AdjustableProperty type, BindableDouble adjustBindable)
|
||||||
|
{
|
||||||
|
adjustments.Remove((type, adjustBindable));
|
||||||
|
channels?.ForEach(c => c.RemoveAdjustment(type, adjustBindable));
|
||||||
|
}
|
||||||
|
|
||||||
public override bool IsPresent => Scheduler.HasPendingTasks;
|
public override bool IsPresent => Scheduler.HasPendingTasks;
|
||||||
|
|
||||||
|
@ -71,6 +83,9 @@ protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||||
{
|
{
|
||||||
ch.Looping = looping;
|
ch.Looping = looping;
|
||||||
ch.Volume.Value = s.Volume / 100.0;
|
ch.Volume.Value = s.Volume / 100.0;
|
||||||
|
|
||||||
|
foreach (var adjustment in adjustments)
|
||||||
|
ch.AddAdjustment(adjust.Item1, adjust.Item2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ch;
|
return ch;
|
||||||
|
|
Loading…
Reference in New Issue