mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 09:03:01 +08:00
Enforce minimum gameplay sample volume of 5%
This commit is contained in:
parent
a26e0bda35
commit
b321d556b6
@ -108,7 +108,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
RelativeSizeAxes = Axes.X
|
RelativeSizeAxes = Axes.X
|
||||||
},
|
},
|
||||||
tailContainer = new Container<DrawableHoldNoteTail> { RelativeSizeAxes = Axes.Both },
|
tailContainer = new Container<DrawableHoldNoteTail> { RelativeSizeAxes = Axes.Both },
|
||||||
slidingSample = new PausableSkinnableSound { Looping = true }
|
slidingSample = new PausableSkinnableSound
|
||||||
|
{
|
||||||
|
Looping = true,
|
||||||
|
MinimumSampleVolume = MINIMUM_SAMPLE_VOLUME,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
maskedContents.AddRange(new[]
|
maskedContents.AddRange(new[]
|
||||||
|
@ -107,7 +107,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
headContainer = new Container<DrawableSliderHead> { RelativeSizeAxes = Axes.Both },
|
headContainer = new Container<DrawableSliderHead> { RelativeSizeAxes = Axes.Both },
|
||||||
OverlayElementContainer = new Container { RelativeSizeAxes = Axes.Both, },
|
OverlayElementContainer = new Container { RelativeSizeAxes = Axes.Both, },
|
||||||
Ball,
|
Ball,
|
||||||
slidingSample = new PausableSkinnableSound { Looping = true }
|
slidingSample = new PausableSkinnableSound
|
||||||
|
{
|
||||||
|
Looping = true,
|
||||||
|
MinimumSampleVolume = MINIMUM_SAMPLE_VOLUME,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
PositionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
|
PositionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
|
||||||
|
@ -99,6 +99,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
spinningSample = new PausableSkinnableSound
|
spinningSample = new PausableSkinnableSound
|
||||||
{
|
{
|
||||||
Volume = { Value = 0 },
|
Volume = { Value = 0 },
|
||||||
|
MinimumSampleVolume = MINIMUM_SAMPLE_VOLUME,
|
||||||
Looping = true,
|
Looping = true,
|
||||||
Frequency = { Value = spinning_sample_initial_frequency }
|
Frequency = { Value = spinning_sample_initial_frequency }
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,26 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal bool IsInitialized;
|
internal bool IsInitialized;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The minimum allowable volume for sample playback.
|
||||||
|
/// <see cref="Samples"/> quieter than that will be forcibly played at this volume instead.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// <para>
|
||||||
|
/// Drawable hitobjects adding their own custom samples, or other sample playback sources
|
||||||
|
/// (i.e. <see cref="GameplaySampleTriggerSource"/>) must enforce this themselves.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// This sample volume floor is present in stable, although it is set at 8% rather than 5%.
|
||||||
|
/// See: https://github.com/peppy/osu-stable-reference/blob/3ea48705eb67172c430371dcfc8a16a002ed0d3d/osu!/Audio/AudioEngine.cs#L1070,
|
||||||
|
/// https://github.com/peppy/osu-stable-reference/blob/3ea48705eb67172c430371dcfc8a16a002ed0d3d/osu!/Audio/AudioEngine.cs#L1404-L1405.
|
||||||
|
/// The reason why it is 5% here is that the 8% cap was enforced in a silent manner
|
||||||
|
/// (i.e. the minimum selectable volume in the editor was 5%, but it would be played at 8% anyways),
|
||||||
|
/// which is confusing and arbitrary, so we're just doing 5% here at the cost of sacrificing strict parity.
|
||||||
|
/// </para>
|
||||||
|
/// </remarks>
|
||||||
|
public const int MINIMUM_SAMPLE_VOLUME = 5;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="DrawableHitObject"/>.
|
/// Creates a new <see cref="DrawableHitObject"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -181,7 +201,10 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
comboColourBrightness.BindTo(gameplaySettings.ComboColourNormalisationAmount);
|
comboColourBrightness.BindTo(gameplaySettings.ComboColourNormalisationAmount);
|
||||||
|
|
||||||
// Explicit non-virtual function call in case a DrawableHitObject overrides AddInternal.
|
// Explicit non-virtual function call in case a DrawableHitObject overrides AddInternal.
|
||||||
base.AddInternal(Samples = new PausableSkinnableSound());
|
base.AddInternal(Samples = new PausableSkinnableSound
|
||||||
|
{
|
||||||
|
MinimumSampleVolume = MINIMUM_SAMPLE_VOLUME
|
||||||
|
});
|
||||||
|
|
||||||
CurrentSkin = skinSource;
|
CurrentSkin = skinSource;
|
||||||
CurrentSkin.SourceChanged += skinSourceChanged;
|
CurrentSkin.SourceChanged += skinSourceChanged;
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
@ -45,7 +46,10 @@ namespace osu.Game.Rulesets.UI
|
|||||||
Child = hitSounds = new Container<SkinnableSound>
|
Child = hitSounds = new Container<SkinnableSound>
|
||||||
{
|
{
|
||||||
Name = "concurrent sample pool",
|
Name = "concurrent sample pool",
|
||||||
ChildrenEnumerable = Enumerable.Range(0, max_concurrent_hitsounds).Select(_ => new PausableSkinnableSound())
|
ChildrenEnumerable = Enumerable.Range(0, max_concurrent_hitsounds).Select(_ => new PausableSkinnableSound
|
||||||
|
{
|
||||||
|
MinimumSampleVolume = DrawableHitObject.MINIMUM_SAMPLE_VOLUME
|
||||||
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,12 @@ namespace osu.Game.Skinning
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class SkinnableSound : SkinReloadableDrawable, IAdjustableAudioComponent
|
public partial class SkinnableSound : SkinReloadableDrawable, IAdjustableAudioComponent
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The minimum allowable volume for <see cref="Samples"/>.
|
||||||
|
/// <see cref="Samples"/> that specify a lower <see cref="ISampleInfo.Volume"/> will be forcibly pulled up to this volume.
|
||||||
|
/// </summary>
|
||||||
|
public int MinimumSampleVolume { get; set; }
|
||||||
|
|
||||||
public override bool RemoveWhenNotAlive => false;
|
public override bool RemoveWhenNotAlive => false;
|
||||||
public override bool RemoveCompletedTransforms => false;
|
public override bool RemoveCompletedTransforms => false;
|
||||||
|
|
||||||
@ -156,7 +162,7 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
var sample = samplePool?.GetPooledSample(s) ?? new PoolableSkinnableSample(s);
|
var sample = samplePool?.GetPooledSample(s) ?? new PoolableSkinnableSample(s);
|
||||||
sample.Looping = Looping;
|
sample.Looping = Looping;
|
||||||
sample.Volume.Value = s.Volume / 100.0;
|
sample.Volume.Value = Math.Max(s.Volume, MinimumSampleVolume) / 100.0;
|
||||||
|
|
||||||
samplesContainer.Add(sample);
|
samplesContainer.Add(sample);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user