1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-21 08:52:54 +08:00

Merge pull request #15844 from mk56-spn/positional-sounds-strength-adjustment

Positional sounds strength adjustment slider implementation
This commit is contained in:
Dean Herbert 2022-01-03 14:30:25 +09:00 committed by GitHub
commit d4ea57c660
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 19 deletions

View File

@ -98,6 +98,8 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.MenuParallax, true); SetDefault(OsuSetting.MenuParallax, true);
// Gameplay // Gameplay
SetDefault(OsuSetting.PositionalHitsounds, true); // replaced by level setting below, can be removed 20220703.
SetDefault(OsuSetting.PositionalHitsoundsLevel, 0.2f, 0, 1);
SetDefault(OsuSetting.DimLevel, 0.8, 0, 1, 0.01); SetDefault(OsuSetting.DimLevel, 0.8, 0, 1, 0.01);
SetDefault(OsuSetting.BlurLevel, 0, 0, 1, 0.01); SetDefault(OsuSetting.BlurLevel, 0, 0, 1, 0.01);
SetDefault(OsuSetting.LightenDuringBreaks, true); SetDefault(OsuSetting.LightenDuringBreaks, true);
@ -109,7 +111,6 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.ShowHealthDisplayWhenCantFail, true); SetDefault(OsuSetting.ShowHealthDisplayWhenCantFail, true);
SetDefault(OsuSetting.FadePlayfieldWhenHealthLow, true); SetDefault(OsuSetting.FadePlayfieldWhenHealthLow, true);
SetDefault(OsuSetting.KeyOverlay, false); SetDefault(OsuSetting.KeyOverlay, false);
SetDefault(OsuSetting.PositionalHitSounds, true);
SetDefault(OsuSetting.AlwaysPlayFirstComboBreak, true); SetDefault(OsuSetting.AlwaysPlayFirstComboBreak, true);
SetDefault(OsuSetting.FloatingComments, false); SetDefault(OsuSetting.FloatingComments, false);
@ -175,9 +176,11 @@ namespace osu.Game.Configuration
int combined = (year * 10000) + monthDay; int combined = (year * 10000) + monthDay;
if (combined < 20210413) if (combined < 20220103)
{ {
SetValue(OsuSetting.EditorWaveformOpacity, 0.25f); var positionalHitsoundsEnabled = GetBindable<bool>(OsuSetting.PositionalHitsounds);
if (!positionalHitsoundsEnabled.Value)
SetValue(OsuSetting.PositionalHitsoundsLevel, 0);
} }
} }
@ -256,7 +259,8 @@ namespace osu.Game.Configuration
LightenDuringBreaks, LightenDuringBreaks,
ShowStoryboard, ShowStoryboard,
KeyOverlay, KeyOverlay,
PositionalHitSounds, PositionalHitsounds,
PositionalHitsoundsLevel,
AlwaysPlayFirstComboBreak, AlwaysPlayFirstComboBreak,
FloatingComments, FloatingComments,
HUDVisibilityMode, HUDVisibilityMode,

View File

@ -32,6 +32,11 @@ namespace osu.Game.Localisation
/// <summary> /// <summary>
/// "Master" /// "Master"
/// </summary> /// </summary>
public static LocalisableString PositionalLevel => new TranslatableString(getKey(@"positional_hitsound_audio_level"), @"Hitsound stereo separation");
/// <summary>
/// "Level"
/// </summary>
public static LocalisableString MasterVolume => new TranslatableString(getKey(@"master_volume"), @"Master"); public static LocalisableString MasterVolume => new TranslatableString(getKey(@"master_volume"), @"Master");
/// <summary> /// <summary>

View File

@ -84,11 +84,6 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString AlwaysShowKeyOverlay => new TranslatableString(getKey(@"key_overlay"), @"Always show key overlay"); public static LocalisableString AlwaysShowKeyOverlay => new TranslatableString(getKey(@"key_overlay"), @"Always show key overlay");
/// <summary>
/// "Positional hitsounds"
/// </summary>
public static LocalisableString PositionalHitsounds => new TranslatableString(getKey(@"positional_hitsounds"), @"Positional hitsounds");
/// <summary> /// <summary>
/// "Always play first combo break sound" /// "Always play first combo break sound"
/// </summary> /// </summary>

View File

@ -14,20 +14,23 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
protected override LocalisableString Header => GameplaySettingsStrings.AudioHeader; protected override LocalisableString Header => GameplaySettingsStrings.AudioHeader;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load(OsuConfigManager config, OsuConfigManager osuConfig)
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new SettingsCheckbox new SettingsSlider<float>
{ {
LabelText = GameplaySettingsStrings.PositionalHitsounds, LabelText = AudioSettingsStrings.PositionalLevel,
Current = config.GetBindable<bool>(OsuSetting.PositionalHitSounds) Keywords = new[] { @"positional", @"balance" },
Current = osuConfig.GetBindable<float>(OsuSetting.PositionalHitsoundsLevel),
KeyboardStep = 0.01f,
DisplayAsPercentage = true
}, },
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = GameplaySettingsStrings.AlwaysPlayFirstComboBreak, LabelText = GameplaySettingsStrings.AlwaysPlayFirstComboBreak,
Current = config.GetBindable<bool>(OsuSetting.AlwaysPlayFirstComboBreak) Current = config.GetBindable<bool>(OsuSetting.AlwaysPlayFirstComboBreak)
}, }
}; };
} }
} }

View File

@ -123,9 +123,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
public readonly Bindable<double> StartTimeBindable = new Bindable<double>(); public readonly Bindable<double> StartTimeBindable = new Bindable<double>();
private readonly BindableList<HitSampleInfo> samplesBindable = new BindableList<HitSampleInfo>(); private readonly BindableList<HitSampleInfo> samplesBindable = new BindableList<HitSampleInfo>();
private readonly Bindable<bool> userPositionalHitSounds = new Bindable<bool>();
private readonly Bindable<int> comboIndexBindable = new Bindable<int>(); private readonly Bindable<int> comboIndexBindable = new Bindable<int>();
private readonly Bindable<float> positionalHitsoundsLevel = new Bindable<float>();
private readonly Bindable<int> comboIndexWithOffsetsBindable = new Bindable<int>(); private readonly Bindable<int> comboIndexWithOffsetsBindable = new Bindable<int>();
protected override bool RequiresChildrenUpdate => true; protected override bool RequiresChildrenUpdate => true;
@ -168,7 +168,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config, ISkinSource skinSource) private void load(OsuConfigManager config, ISkinSource skinSource)
{ {
config.BindWith(OsuSetting.PositionalHitSounds, userPositionalHitSounds); config.BindWith(OsuSetting.PositionalHitsoundsLevel, positionalHitsoundsLevel);
// Explicit non-virtual function call. // Explicit non-virtual function call.
base.AddInternal(Samples = new PausableSkinnableSound()); base.AddInternal(Samples = new PausableSkinnableSound());
@ -532,9 +532,10 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// <param name="position">The lookup X position. Generally should be <see cref="SamplePlaybackPosition"/>.</param> /// <param name="position">The lookup X position. Generally should be <see cref="SamplePlaybackPosition"/>.</param>
protected double CalculateSamplePlaybackBalance(double position) protected double CalculateSamplePlaybackBalance(double position)
{ {
const float balance_adjust_amount = 0.4f; float balanceAdjustAmount = positionalHitsoundsLevel.Value * 2;
double returnedvalue = balanceAdjustAmount * (position - 0.5f);
return balance_adjust_amount * (userPositionalHitSounds.Value ? position - 0.5f : 0); return returnedvalue;
} }
/// <summary> /// <summary>