New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve silence detection in MutedNotification
#26951
Conversation
Instead of checking the master and music volumes separately to see if they're <= 1%, check the aggregate of the two volumes to see if it's <= -60 dB. When muted notification is activated, restore the aggregate volume level to -30 dB.
Lowering the master volume in the previous test meant that the volume levels would end up being modified.
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.
Decibels are irrelevant in the volume bindables, as mentioned in PR already.
The logic seems fine. I don't understand why the target volume has been lowered down to 10%. I brought it back to 50% as I don't believe it's relevant to the intent of this PR given by the title and description. |
Float casts aren't vital, there were just these small inaccuracies that would start to pop up that were kinda bugging me. That probably won't be an issue though if the target volume was brought back up to 50%, since 0.5 is a power of 2, so there's no mantissa to worry about. Actually, never mind, it's not the target volume but rather the silence threshold that's being compared against. Again, it's probably fine either way. |
Aggregate volume needs to be <= 0.01 in order to trigger the silence threshold. On second thought, you should probably put the float casts back in because double x = 0.1;
double y = 0.1;
double agg = (float)(x * y);
Console.WriteLine($"{x * y}\n{agg}");
Console.WriteLine($"{x * y <= 0.01}\n{agg <= 0.01}"); output:
|
Head branch was pushed to by a user without write access
|
audioManager.Volume.Value = 0.5f; | ||
if (audioManager.VolumeTrack.Value <= volume_requirement) | ||
audioManager.VolumeTrack.Value = 0.5f; | ||
if (aggregateVolumeTrack <= volume_requirement) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is all so black box to a user. I'd still prefer the old hard cut increases, then let the user adjust further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds fine, I agree it's a touch more complicated/arbitrary but wasn't sure if it warrants a discussion.
On entering a
PlayerLoader
screen, aMutedNotification
will offer to restore the volume to an audible level if either the master or music volume level is <= 1%.The problem with this logic is that, since the volume levels are multiplied together, 1% of 100% will be exactly the same volume level as 10% of 10%, or 2% of 50%, but only the first scenario would prompt a notification.
Instead, we should be checking their aggregate volume to see if it's below a certain threshold, and then raising the volume levels to reach a specific aggregate amount.