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

Fix audio not dimming after race condition (#5049)

Fix audio not dimming after race condition
This commit is contained in:
Dean Herbert 2019-06-21 22:24:36 +09:00 committed by GitHub
commit ca2a3937ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -181,10 +181,10 @@ namespace osu.Game
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);
Beatmap.BindValueChanged(beatmapChanged, true);
}
@ -707,22 +707,14 @@ namespace osu.Game
#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<double>(OsuSetting.VolumeInactive), 4000, Easing.OutQuint);
}
#endregion