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

Show mic muted toast with optimizations service running #3534

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion app/Helpers/Audio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static bool ToggleMute()
var mmDevice = enumerator.GetDefaultAudioEndpoint(DataFlow.Capture, Role.Multimedia);

bool status = !commDevice.AudioEndpointVolume.Mute;

commDevice.AudioEndpointVolume.Mute = status;
consoleDevice.AudioEndpointVolume.Mute = status;
mmDevice.AudioEndpointVolume.Mute = status;
Expand All @@ -25,5 +25,15 @@ public static bool ToggleMute()
return status;
}
}

public static bool IsMuted()
{
using (var enumerator = new MMDeviceEnumerator())
{
var commDevice = enumerator.GetDefaultAudioEndpoint(DataFlow.Capture, Role.Communications);

return commDevice.AudioEndpointVolume.Mute;
}
}
}
}
4 changes: 2 additions & 2 deletions app/Input/InputDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ public static void KeyProcess(string name = "m3")
action = "aura";
if (name == "fnf5")
action = "performance";
if (name == "m3" && !OptimizationService.IsRunning())
if (name == "m3")
action = "micmute";
if (name == "fnc")
action = "fnlock";
Expand Down Expand Up @@ -621,7 +621,7 @@ public static void KeyProcess(string name = "m3")

static void ToggleMic()
{
bool muteStatus = Audio.ToggleMute();
bool muteStatus = OptimizationService.IsRunning() ? Audio.IsMuted() : Audio.ToggleMute();
Program.toast.RunToast(muteStatus ? Properties.Strings.Muted : Properties.Strings.Unmuted, muteStatus ? ToastIcon.MicrophoneMute : ToastIcon.Microphone);
if (AppConfig.IsVivoZenbook()) Program.acpi.DeviceSet(AsusACPI.MicMuteLed, muteStatus ? 1 : 0, "MicmuteLed");
}
Expand Down