1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

Move dampening to base implementation and change range to 0..1

This commit is contained in:
Dean Herbert 2020-04-13 13:00:03 +09:00
parent 22d89dbff7
commit 65b96079a0
4 changed files with 15 additions and 8 deletions

View File

@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
public float DisplayRadius => DrawSize.X / 2 * Scale.X * HitObject.Scale;
protected override float SamplePlaybackBalance => 0.8f * HitObject.X - 0.4f;
protected override float SamplePlaybackPosition => HitObject.X;
protected DrawableCatchHitObject(CatchHitObject hitObject)
: base(hitObject)

View File

@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
protected readonly IBindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
protected override float SamplePlaybackBalance
protected override float SamplePlaybackPosition
{
get
{

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Graphics.Containers;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
@ -18,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
// Must be set to update IsHovered as it's used in relax mdo to detect osu hit objects.
public override bool HandlePositionalInput => true;
protected override float SamplePlaybackBalance => (HitObject.X / 512f - 0.5f) * 0.8f;
protected override float SamplePlaybackPosition => HitObject.X / OsuPlayfield.BASE_SIZE.X;
/// <summary>
/// Whether this <see cref="DrawableOsuHitObject"/> can be hit.

View File

@ -87,11 +87,15 @@ namespace osu.Game.Rulesets.Objects.Drawables
public JudgementResult Result { get; private set; }
/// <summary>
/// The stereo balance of the samples played if <i>Positional hitsounds</i> is set.
/// The relative X position of this hit object for sample playback balance adjustment.
/// </summary>
protected virtual float SamplePlaybackBalance => 0;
/// <remarks>
/// This is a range of 0..1 (0 for far-left, 0.5 for centre, 1 for far-right).
/// Dampening is post-applied to ensure the effect is not too intense.
/// </remarks>
protected virtual float SamplePlaybackPosition => 0.5f;
private readonly BindableDouble samplePlaybackBalanceAdjustment = new BindableDouble();
private readonly BindableDouble balanceAdjust = new BindableDouble();
private BindableList<HitSampleInfo> samplesBindable;
private Bindable<double> startTimeBindable;
@ -168,7 +172,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
}
Samples = new SkinnableSound(samples.Select(s => HitObject.SampleControlPoint.ApplyTo(s)));
Samples.AddAdjustment(AdjustableProperty.Balance, samplePlaybackBalanceAdjustment);
Samples.AddAdjustment(AdjustableProperty.Balance, balanceAdjust);
AddInternal(Samples);
}
@ -368,7 +372,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// </summary>
public virtual void PlaySamples()
{
samplePlaybackBalanceAdjustment.Value = userPositionalHitSounds.Value ? SamplePlaybackBalance : 0;
const float balance_adjust_amount = 0.4f;
balanceAdjust.Value = balance_adjust_amount * (userPositionalHitSounds.Value ? SamplePlaybackPosition - 0.5f : 0);
Samples?.Play();
}