diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs
index f10d11827b..d1a6463d72 100644
--- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs
+++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs
@@ -83,8 +83,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private SkinnableSound spinningSample;
- private const float minimum_volume = 0.0001f;
-
protected override void LoadSamples()
{
base.LoadSamples();
@@ -101,7 +99,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
AddInternal(spinningSample = new SkinnableSound(clone)
{
- Volume = { Value = minimum_volume },
+ Volume = { Value = 0 },
Looping = true,
});
}
@@ -119,7 +117,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}
else
{
- spinningSample?.VolumeTo(minimum_volume, 200).Finally(_ => spinningSample.Stop());
+ spinningSample?.VolumeTo(0, 200).Finally(_ => spinningSample.Stop());
}
}
diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs
index 97f1d1c91d..65f34aba3e 100644
--- a/osu.Game/Screens/Play/PauseOverlay.cs
+++ b/osu.Game/Screens/Play/PauseOverlay.cs
@@ -26,8 +26,6 @@ namespace osu.Game.Screens.Play
protected override Action BackAction => () => InternalButtons.Children.First().Click();
- private const float minimum_volume = 0.0001f;
-
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
@@ -38,10 +36,8 @@ namespace osu.Game.Screens.Play
AddInternal(pauseLoop = new SkinnableSound(new SampleInfo("pause-loop"))
{
Looping = true,
+ Volume = { Value = 0 }
});
-
- // SkinnableSound only plays a sound if its aggregate volume is > 0, so the volume must be turned up before playing it
- pauseLoop.VolumeTo(minimum_volume);
}
protected override void PopIn()
@@ -56,7 +52,7 @@ namespace osu.Game.Screens.Play
{
base.PopOut();
- pauseLoop.VolumeTo(minimum_volume, TRANSITION_DURATION, Easing.OutQuad).Finally(_ => pauseLoop.Stop());
+ pauseLoop.VolumeTo(0, TRANSITION_DURATION, Easing.OutQuad).Finally(_ => pauseLoop.Stop());
}
}
}
diff --git a/osu.Game/Skinning/SkinnableSound.cs b/osu.Game/Skinning/SkinnableSound.cs
index 11856fa581..cf629f231f 100644
--- a/osu.Game/Skinning/SkinnableSound.cs
+++ b/osu.Game/Skinning/SkinnableSound.cs
@@ -27,6 +27,16 @@ namespace osu.Game.Skinning
public override bool RemoveWhenNotAlive => false;
public override bool RemoveCompletedTransforms => false;
+ ///
+ /// Whether to play the underlying sample when aggregate volume is zero.
+ /// Note that this is checked at the point of calling ; changing the volume post-play will not begin playback.
+ /// Defaults to false unless .
+ ///
+ ///
+ /// Can serve as an optimisation if it is known ahead-of-time that this behaviour is allowed in a given use case.
+ ///
+ protected bool PlayWhenZeroVolume => Looping;
+
private readonly AudioContainer samplesContainer;
public SkinnableSound(ISampleInfo hitSamples)
@@ -86,7 +96,7 @@ namespace osu.Game.Skinning
{
samplesContainer.ForEach(c =>
{
- if (c.AggregateVolume.Value > 0)
+ if (PlayWhenZeroVolume || c.AggregateVolume.Value > 0)
c.Play();
});
}