Add positional sound support for all rulesets

The SamplePlaybackBalance is calculated in a way that the balance
remains between -0.4 and 0.4.
Positional sound is not supported in osu!taiko.
This commit is contained in:
Fire937
2020-04-12 01:33:25 +02:00
parent c17e470266
commit f274ec297c
4 changed files with 28 additions and 18 deletions

View File

@ -5,8 +5,10 @@ using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Rulesets.Mania.UI;
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
@ -24,6 +26,20 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
protected readonly IBindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
protected override float SamplePlaybackBalance
{
get
{
CompositeDrawable stage = this;
while (!(stage is Stage))
stage = stage.Parent;
var columnCount = ((Stage)stage).Columns.Count;
var columnIndex = HitObject.Column;
return 0.8f * columnIndex / (columnCount - 1) - 0.4f;
}
}
protected DrawableManiaHitObject(ManiaHitObject hitObject)
: base(hitObject)
{