diff --git a/osu.Game/Screens/Menu/KiaiMenuFountains.cs b/osu.Game/Screens/Menu/KiaiMenuFountains.cs index e62ef31278..b57012eaf7 100644 --- a/osu.Game/Screens/Menu/KiaiMenuFountains.cs +++ b/osu.Game/Screens/Menu/KiaiMenuFountains.cs @@ -3,7 +3,6 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Platform; using osu.Framework.Utils; @@ -21,18 +20,14 @@ namespace osu.Game.Screens.Menu [Resolved] private GameHost host { get; set; } = null!; - [Resolved] - private ISkinSource skin { get; set; } = null!; - - private ISample? sample; - private SampleChannel? sampleChannel; + private SkinnableSound? sample; [BackgroundDependencyLoader] private void load() { RelativeSizeAxes = Axes.Both; - Children = new[] + Children = new Drawable[] { leftFountain = new StarFountain { @@ -46,9 +41,8 @@ namespace osu.Game.Screens.Menu Origin = Anchor.BottomRight, X = -250, }, + sample = new SkinnableSound(new SampleInfo("Gameplay/fountain-shoot")) }; - - sample = skin.GetSample(new SampleInfo(@"Gameplay/fountain-shoot")); } private bool isTriggered; @@ -89,13 +83,9 @@ namespace osu.Game.Screens.Menu break; } - // Don't play SFX when game is in background - if (!host.IsActive.Value) return; - - // Track sample channel to avoid overlapping playback - sampleChannel?.Stop(); - sampleChannel = sample?.GetChannel(); - sampleChannel?.Play(); + // Don't play SFX when game is in background as it can be a bit noisy. + if (host.IsActive.Value) + sample?.Play(); } } } diff --git a/osu.Game/Screens/Play/KiaiGameplayFountains.cs b/osu.Game/Screens/Play/KiaiGameplayFountains.cs index c8dcee2580..017e66253f 100644 --- a/osu.Game/Screens/Play/KiaiGameplayFountains.cs +++ b/osu.Game/Screens/Play/KiaiGameplayFountains.cs @@ -3,7 +3,6 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Utils; @@ -22,11 +21,7 @@ namespace osu.Game.Screens.Play private Bindable kiaiStarFountains = null!; - [Resolved] - private ISkinSource skin { get; set; } = null!; - - private ISample? sample; - private SampleChannel? sampleChannel; + private SkinnableSound? sample; [BackgroundDependencyLoader] private void load(OsuConfigManager config) @@ -35,7 +30,7 @@ namespace osu.Game.Screens.Play RelativeSizeAxes = Axes.Both; - Children = new[] + Children = new Drawable[] { leftFountain = new GameplayStarFountain { @@ -49,9 +44,8 @@ namespace osu.Game.Screens.Play Origin = Anchor.BottomRight, X = -75, }, + sample = new SkinnableSound(new SampleInfo("Gameplay/fountain-shoot")) }; - - sample = skin.GetSample(new SampleInfo(@"Gameplay/fountain-shoot")); } private bool isTriggered; @@ -78,10 +72,7 @@ namespace osu.Game.Screens.Play leftFountain.Shoot(1); rightFountain.Shoot(-1); - // Track sample channel to avoid overlapping playback - sampleChannel?.Stop(); - sampleChannel = sample?.GetChannel(); - sampleChannel?.Play(); + sample?.Play(); } public partial class GameplayStarFountain : StarFountain