Windows 10 - Find active Microphone in registry (incomplete)

Hello Folks,

i’m trying to make a relevance that will tell me if a microphone of a certain manufacturer is installed and active.
These information are stored here:
HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture

I need to dig inside thse key and find those Microphone where the DWORD key “DeviceState” is at 1
Example:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture{8ea79f90-7ccf-4aea-8022-ce1cfe19df0d}
DeviceState= Dword:1

I also need to return only digged result where the caption of the product contains "speechmike"
Actually i have these relevance but i’m not able to combine it, the name of a product is stored under this key
{b3f8fa53-0004-438e-9003-51a46e139bfc},6
Example:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture{8ea79f90-7ccf-4aea-8022-ce1cfe19df0d}\Properties
{b3f8fa53-0004-438e-9003-51a46e139bfc},6 => REG_SZ = Sennheiser USB headset

My relavance should return only speechmike microphone that is active
Actually here is my incomplete code

q: values whose (it as string as lowercase contains “sennheiser” as lowercase) of (it;keys of it; keys of keys of it) of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture” of native registry
A: Sennheiser USB headset
A: Sennheiser USB headset
A: Sennheiser USB headset

This return 3 values, but 2 are not active, i want to filter on DeviceState=1 that is on the parent path of the registry

Thanks for nay help

structure of the keys:

HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture<guid of the device>\DeviceState (DWORD to 1 if active)

HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture<guid of the device>\Properties{b3f8fa53-0004-438e-9003-51a46e139bfc},6 (REG_SZ conting strinf of the product)

Here are some screenshot if my explanation are not clear :slight_smile:

Here is a hot tip while I work on the complete relevance

q: values "{b3f8fa53-0004-438e-9003-51a46e139bfc},6" of keys "Properties" of keys whose (exists key "Properties" of it) of Keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture" of (registry; native registry)
A: NVIDIA High Definition Audio
A: HD Pro Webcam C920
A: Realtek(R) Audio
A: NVIDIA High Definition Audio
A: NVIDIA High Definition Audio
A: NVIDIA High Definition Audio

Whose creates the filter… just need to get the right filter into the right place in the relevance.

q: values "{b3f8fa53-0004-438e-9003-51a46e139bfc},6" of keys "Properties" of keys whose (value "{b3f8fa53-0004-438e-9003-51a46e139bfc},6" of key "Properties" of it as string contains "NVIDIA") of Keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture" of (registry; native registry)
A: NVIDIA High Definition Audio
A: NVIDIA High Definition Audio
A: NVIDIA High Definition Audio
A: NVIDIA High Definition Audio

Hello, thanks for help but it does not give the actual active Mic that is filtered with DeviceState DWORD to 1

Any suggestion?

Thank you

Is this your card?

q: exists keys "Properties" of keys whose ((value "{b3f8fa53-0004-438e-9003-51a46e139bfc},6" of key "Properties" of it as string as lowercase contains "nvidia") AND (value "DeviceState" of it as integer = 1)) of Keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture" of (registry; native registry)
T: 0.846 ms

Very big thanks, it is the targeted entries, now i need to return true or false to apply a fix with soundvolume, how don’t know how to do

sorry a simple exist do the job, here is the complete code. Thank for your help

exist keys “Properties” of keys whose ((value “{b3f8fa53-0004-438e-9003-51a46e139bfc},6” of key “Properties” of it as string as lowercase contains “sennheiser”) AND (value “DeviceState” of it as integer = 1)) of Keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture” of (registry; native registry)

1 Like

@cmbc

The thing I hope you took away is that your Whose clause can filter different things at the same time. Filtering was for the DeviceState at one level of registry key and for Properties value of a subkey.

Thanks for explaining your problem statement so well. You have very exact specifications along with a screenshot and your “relevance so far”. You made it very easy to help!

I was not aware that i could filter two times with whose clause, thanks for your great help

I did notice that on my own device, I had some other integer values in my “DeviceState” Key Value.

I turned my WebCam on (with a microphone) so I rather expected one of my WebCam devices to change to state “1”

q: (values "DeviceState" of it, values "{b3f8fa53-0004-438e-9003-51a46e139bfc},6" of keys "Properties" of it) of keys of Keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture" of (registry; native registry)
A: 268435460, NVIDIA High Definition Audio
A: 536870916, HD Pro Webcam C920
A: 1, Realtek(R) Audio
A: 268435460, NVIDIA High Definition Audio
A: 268435460, NVIDIA High Definition Audio
A: 268435460, NVIDIA High Definition Audio