Closed tomm1996 closed 2 years ago
I ended up solving it like this:
$Microphone = "{0.0.1.00000000}.{50486949-aae2-4574-97fb-4660fd26b6f7}"
$Headset = "{0.0.1.00000000}.{4bf15a7e-d091-4bcb-ae8f-5cadfdcffca7}"
while (1) {
$ActiveDevice = Get-AudioDevice -Recording
$HeadSetObject = Get-AudioDevice -ID $Headset
$HeadSetIsMuted = $HeadSetObject."Device"."AudioEndpointVolume"."Mute"
if ($HeadSetIsMuted) {
if ($ActiveDevice."ID" -eq $HeadSet) {
Set-AudioDevice -ID $Microphone
}
} else {
if ($ActiveDevice."ID" -eq $Microphone) {
Set-AudioDevice -ID $Headset
}
}
sleep 3;
}
This is device dependant though. $HeadSetObject."Device"."AudioEndpointVolume"."Mute"
changes for the physical mute of my headset, but not for the physical mute of my microphone. You gotta test it out if you want to use it.
Hi, First of all, thanks for the handy cmdlet.
I hope this is the right place to ask:
I'm by no means a powershell expert (or even decent for that matter) but I'm currently trying to use your tool to switch from Input Device A to Input Device B if Device B is not muted. Else, I want to switch back.
This is what I currently have:
But the switching basically cuts my voice for some time every three seconds, so it's pretty impractical. Is there a way to either do this event-based instead of in a loop or by checking the mute state of device B without switching? Or maybe an entirely different approach?