From c32d17d16a4db072151b369590ccf261e23b8afd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Jun 2019 01:32:52 +0900 Subject: [PATCH] Fix audio not dimming after race condition Also adjusts transition slightly for smoother effect. --- osu.Game/OsuGame.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index f38eecef81..d856e6b935 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -181,9 +181,9 @@ private void load(FrameworkConfigManager frameworkConfig) configSkin.ValueChanged += skinId => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == skinId.NewValue) ?? SkinInfo.Default; configSkin.TriggerChange(); - LocalConfig.BindWith(OsuSetting.VolumeInactive, userInactiveVolume); - IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true); + + Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade); } private ExternalLinkOpener externalLinkOpener; @@ -688,22 +688,14 @@ public bool OnPressed(GlobalAction action) #region Inactive audio dimming - private readonly BindableDouble userInactiveVolume = new BindableDouble(); - private readonly BindableDouble inactiveVolumeFade = new BindableDouble(); private void updateActiveState(bool isActive) { if (isActive) - { - this.TransformBindableTo(inactiveVolumeFade, 1, 500, Easing.OutQuint) - .Finally(_ => Audio.RemoveAdjustment(AdjustableProperty.Volume, inactiveVolumeFade)); //wait for the transition to finish to remove the inactive audio adjustment - } + this.TransformBindableTo(inactiveVolumeFade, 1, 400, Easing.OutQuint); else - { - Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade); - this.TransformBindableTo(inactiveVolumeFade, userInactiveVolume.Value, 1500, Easing.OutSine); - } + this.TransformBindableTo(inactiveVolumeFade, LocalConfig.Get(OsuSetting.VolumeInactive), 4000, Easing.OutQuint); } #endregion