Windows 10 Disabling Audio input/output (Microphone/Speaker/etc) in Device Manager does not disable device in Sound Control Panel or stop audio...oh my!

  • Thread starter Thread starter paulpv
  • Start date Start date
P

paulpv

In Windows 10 (1803 build 17134.228), I open both "Device Manager" (devmgmt.msc) and the "Sound Control Panel" (mmsys.cpl).


Both Device Manager and the Sound Control Pancel show the same audio input/output devices.

ex: "Speakers" and "Microphone".

This is good!


In Device Manager, I disable "Speakers", which continues to show up and has an icon showing it is disabled.
In Sound Control Panel, "Speakers" still shows up and *is not disabled*!
When I play a sound through the [disabled in Device Manager] Speakers, I can still hear the audio!

This is horrible!


In Device Manager, I re-enable "Speakers".

In Sound Control Panel, I disable "Speakers".

In Device Manager, "Speakers" disappears as an Audio output device.

Audio correctly cannot be heard.

This is good!


In summary:

  1. Why does disabling "Speakers" in "Device Manager" not stop audio coming out of them?
  2. What does disabling "Speakers" in "Device Manager" actually do?
  3. Why is disabling Speakers in Device Manager different than disabling Speakers in Sound Control Panel?


Now for the real meat: I am trying to disable/enable the Audio input/output device...
...the way that the Sound Control Panel does...
...but programmatically (PowerShell, C#, C...whatever works).


There are many of examples of how to disable/enable a device that involve "devcon.exe disable/enable", "Get-PnpDevice | Disable/Enable-PnpDevice", and "Get-Device | Disable/Enable-Device".

All of these result in the device being disabled in the Device Manager, and exhibiting the above undesirable behavior; the audio devices still show up in Sound Control Panel and are usable. :(


I also have tried the Registry hack (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture\{GUID} DeviceState=1 or 10000001), but that seems to be a cosmetic hack only and doesn't actually force close any open devices or prevent new opens.


So I'll add another question:

  1. How can I programmatically disable/enable and audio device to have the same effect as doing it in Sound Control Panel?


And no; UI automation of the Sound Control Panel is not an acceptable answer.

I am looking for an actual API that can be called in the background, not a horrible UI hack that requires being in the foreground.


Thanks!


Pv

Continue reading...
 
Back
Top