mirror of
https://github.com/ppy/osu
synced 2024-12-11 17:42:28 +00:00
Fix audio not dimming after race condition
Also adjusts transition slightly for smoother effect.
This commit is contained in:
parent
0d4c6d2cbc
commit
c32d17d16a
@ -181,9 +181,9 @@ 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);
|
||||
}
|
||||
|
||||
private ExternalLinkOpener externalLinkOpener;
|
||||
@ -688,22 +688,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
|
||||
|
Loading…
Reference in New Issue
Block a user