mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 11:42:54 +08:00
Initial implementation of adjustable positional hitobject audio strength
This commit is contained in:
parent
a0cc7bbdc8
commit
eaa464e548
@ -97,6 +97,7 @@ namespace osu.Game.Configuration
|
||||
SetDefault(OsuSetting.MenuParallax, true);
|
||||
|
||||
// Gameplay
|
||||
SetDefault(OsuSetting.PositionalHitsoundsLevel, 0.8f, 0.1f, 1f);
|
||||
SetDefault(OsuSetting.DimLevel, 0.8, 0, 1, 0.01);
|
||||
SetDefault(OsuSetting.BlurLevel, 0, 0, 1, 0.01);
|
||||
SetDefault(OsuSetting.LightenDuringBreaks, true);
|
||||
@ -251,6 +252,7 @@ namespace osu.Game.Configuration
|
||||
BlurLevel,
|
||||
LightenDuringBreaks,
|
||||
ShowStoryboard,
|
||||
PositionalHitsoundsLevel,
|
||||
KeyOverlay,
|
||||
PositionalHitSounds,
|
||||
AlwaysPlayFirstComboBreak,
|
||||
|
@ -32,6 +32,11 @@ namespace osu.Game.Localisation
|
||||
/// <summary>
|
||||
/// "Master"
|
||||
/// </summary>
|
||||
public static LocalisableString PositionalLevel => new TranslatableString(getKey(@"positional_hitsound_audio_level"), @"Positional hitsound audio level.");
|
||||
|
||||
/// <summary>
|
||||
/// "Level"
|
||||
/// </summary>
|
||||
public static LocalisableString MasterVolume => new TranslatableString(getKey(@"master_volume"), @"Master");
|
||||
|
||||
/// <summary>
|
||||
|
@ -2,10 +2,13 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
{
|
||||
@ -13,9 +16,15 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
{
|
||||
protected override LocalisableString Header => GameplaySettingsStrings.AudioHeader;
|
||||
|
||||
private Bindable<float> positionalHitsoundsLevel;
|
||||
|
||||
private FillFlowContainer<SettingsSlider<float>> positionalHitsoundsSettings;
|
||||
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
private void load(OsuConfigManager config,OsuConfigManager osuConfig)
|
||||
{
|
||||
positionalHitsoundsLevel = osuConfig.GetBindable<float>(OsuSetting.PositionalHitsoundsLevel);
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SettingsCheckbox
|
||||
@ -23,6 +32,23 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
LabelText = GameplaySettingsStrings.PositionalHitsounds,
|
||||
Current = config.GetBindable<bool>(OsuSetting.PositionalHitSounds)
|
||||
},
|
||||
positionalHitsoundsSettings = new FillFlowContainer<SettingsSlider<float>>
|
||||
{
|
||||
Direction = FillDirection.Vertical,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Masking = true,
|
||||
Children = new[]
|
||||
{
|
||||
new SettingsSlider<float>
|
||||
{
|
||||
LabelText = AudioSettingsStrings.PositionalLevel,
|
||||
Current = positionalHitsoundsLevel,
|
||||
KeyboardStep = 0.01f,
|
||||
DisplayAsPercentage = true,
|
||||
},
|
||||
}
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = GameplaySettingsStrings.AlwaysPlayFirstComboBreak,
|
||||
|
@ -22,6 +22,7 @@ using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK.Graphics;
|
||||
using osu.Game.Overlays.Settings.Sections.Gameplay;
|
||||
|
||||
namespace osu.Game.Rulesets.Objects.Drawables
|
||||
{
|
||||
@ -124,6 +125,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
public readonly Bindable<double> StartTimeBindable = new Bindable<double>();
|
||||
private readonly BindableList<HitSampleInfo> samplesBindable = new BindableList<HitSampleInfo>();
|
||||
private readonly Bindable<bool> userPositionalHitSounds = new Bindable<bool>();
|
||||
private readonly Bindable<float> positionalHitsoundsLevel = new Bindable<float>();
|
||||
|
||||
private readonly Bindable<int> comboIndexBindable = new Bindable<int>();
|
||||
private readonly Bindable<int> comboIndexWithOffsetsBindable = new Bindable<int>();
|
||||
@ -532,7 +534,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
/// <param name="position">The lookup X position. Generally should be <see cref="SamplePlaybackPosition"/>.</param>
|
||||
protected double CalculateSamplePlaybackBalance(double position)
|
||||
{
|
||||
const float balance_adjust_amount = 0.4f;
|
||||
float balance_adjust_amount = positionalHitsoundsLevel.Value;
|
||||
|
||||
return balance_adjust_amount * (userPositionalHitSounds.Value ? position - 0.5f : 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user