From f4a2d5f3f489c1332f7e200747dd9b665337db7a Mon Sep 17 00:00:00 2001 From: Mike Will Date: Fri, 2 Feb 2024 02:41:58 -0500 Subject: [PATCH] Round off inaccuracies in the aggregate volume before evaluating --- osu.Game/Screens/Play/PlayerLoader.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 9ec7197429..50c95ce525 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -551,7 +551,8 @@ namespace osu.Game.Screens.Play if (!muteWarningShownOnce.Value) { // Checks if the notification has not been shown yet and also if master volume is muted, track/music volume is muted or if the whole game is muted. - if (volumeOverlay?.IsMuted.Value == true || audioManager.Volume.Value * audioManager.VolumeTrack.Value <= volume_requirement) + double aggregate = Math.Floor(audioManager.Volume.Value * audioManager.VolumeTrack.Value * 100) / 100; + if (volumeOverlay?.IsMuted.Value == true || aggregate <= volume_requirement) { notificationOverlay?.Post(new MutedNotification()); muteWarningShownOnce.Value = true; @@ -582,7 +583,8 @@ namespace osu.Game.Screens.Play // Check values before resetting, as the user may have only had mute enabled, in which case we might not need to adjust volumes. // Note that we only restore to -20 dB to ensure the user isn't suddenly overloaded by unexpectedly high volume. - if (audioManager.Volume.Value * audioManager.VolumeTrack.Value <= volume_requirement) + double aggregate = Math.Floor(audioManager.Volume.Value * audioManager.VolumeTrack.Value * 100) / 100; + if (aggregate <= volume_requirement) { // Prioritize increasing music over master volume as to avoid also increasing effects volume. const double target = 0.1;