1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 15:03:13 +08:00

Increase precision of aggregate volume rounding

It should be large enough to account for true accuracy
but small enough to disregard any hair-thin inaccuracy found
at the very end of the float value.
This commit is contained in:
Mike Will 2024-02-02 13:27:26 -05:00
parent e4ec8c111b
commit 2ab967f783

View File

@ -551,7 +551,7 @@ 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 || Math.Floor(audioManager.Volume.Value * audioManager.VolumeTrack.Value * 100) / 100 <= volume_requirement)
if (volumeOverlay?.IsMuted.Value == true || Math.Floor(audioManager.Volume.Value * audioManager.VolumeTrack.Value * 1e6) / 1e6 <= volume_requirement)
{
notificationOverlay?.Post(new MutedNotification());
muteWarningShownOnce.Value = true;
@ -582,7 +582,7 @@ 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 (Math.Floor(audioManager.Volume.Value * audioManager.VolumeTrack.Value * 100) / 100 <= volume_requirement)
if (Math.Floor(audioManager.Volume.Value * audioManager.VolumeTrack.Value * 1e6) / 1e6 <= volume_requirement)
{
// Prioritize increasing music over master volume as to avoid also increasing effects volume.
const double target = 0.1;