Skip to content
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

Implement auto-mute to improve uncomfortable audio distortion while host is lagging #3866

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

FredTheHunterProgrammer
Copy link

@FredTheHunterProgrammer FredTheHunterProgrammer commented Mar 9, 2024

resolves #3238

DISCLAIMER : I have done this for a school project. I'm not going to think this is going to be accepted at all, but if you could leave some comments I would be grateful.

Added 2 settings in the Sound Settings menu for muting the app in certain circumstances.

The first one is to mute the app when in the background or unfocused and can be toggled on and off.
The second on is to mute the app when the FPS reaches a threshold chosen by the user (by default 56). It can be toggled on and off and the threshold can also be modified in the settings.

image

Check if completed:

Copy link
Member

@YoshiRulz YoshiRulz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this! When I opened the feature request, I had imagined it would be difficult to impossible under the current system, so seeing a proof-of-concept is a huge relief.

.gitignore Outdated Show resolved Hide resolved
src/BizHawk.Client.Common/config/Config.cs Outdated Show resolved Hide resolved
src/BizHawk.Client.EmuHawk/MainForm.cs Show resolved Hide resolved
@@ -28,330 +28,409 @@ protected override void Dispose(bool disposing)
/// </summary>
private void InitializeComponent()
{
this.Cancel = new System.Windows.Forms.Button();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry you had to deal with the Designer. If this feature is accepted, I'll rewrite this in a declarative style, then you can rebase and have a smaller diff.

src/BizHawk.Client.EmuHawk/Program.cs Outdated Show resolved Hide resolved
src/BizHawk.Client.EmuHawk/config/SoundConfig.cs Outdated Show resolved Hide resolved
lua.zip Outdated Show resolved Hide resolved
@YoshiRulz YoshiRulz self-requested a review March 13, 2024 17:54

// Mutes the game if the current FPS reaches the threshold chosen by the user or lower
// An option in the sound settings needs to be turned on for this to work.
if (Config.MuteOnLag && _lastFps <= PlatformFrameRates.GetFrameRate(Emulator.SystemId, Emulator.HasRegions() && Emulator.AsRegionable().Region is DisplayType.PAL) * ((double)Config.FPSThresholdPercentage / 100))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PlatformFrameRates are not intended to query the actual core's framerate per se (they are rather "political numbers"). The core's IVideoProvider provides this kind of information and should be used.

@YoshiRulz YoshiRulz changed the title Audio lag fix Implement auto-mute to improve uncomfortable audio distortion while host is lagging Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-mute when lagging
3 participants