How to enumerate audio endpoint (IMMDevice) properties on your system

Browse code

Download audioendpoints.exe

Pseudocode:

CoCreateInstance(..., &pMMDeviceEnumerator);
pMMDeviceEnumerator->EnumAudioEndpoints(..., &pMMDeviceCollection);
for (each device in the collection) {
    pMMDevice->OpenPropertyStore(...,  &pPropertyStore);
    for (each property in the store) {
        log the property
    }
}

Output on my system:

>audioendpoints.exe
ID: {0.0.0.00000000}.{6d531641-b3e3-43c5-ba56-ba165b4a9bb6}
State: 4 (DEVICE_STATE_NOTPRESENT)
-- Properties (18) --
{b3f8fa53-0004-438e-9003-51a46e139bfc},15:
    VT_BLOB of size 16
    db 07 06 00 03 00 01 00
    17 00 3a 00 2d 00 26 03
DEVPKEY_Device_DeviceDesc:
    VT_LPWSTR Internal AUX Jack
{b3f8fa53-0004-438e-9003-51a46e139bfc},6:
    VT_LPWSTR High Definition Audio Device
{b3f8fa53-0004-438e-9003-51a46e139bfc},2:
    VT_LPWSTR {1}.HDAUDIO\FUNC_01&VEN_8384&DEV_7690&SUBSYS_102801BD&REV_1022\4&33D044FE&0&0001
{83da6326-97a6-4088-9453-a1923f573b29},3:
    VT_LPWSTR hdaudio.inf:Microsoft.ntamd64:HdAudModel:6.1.7600.16385::hdaudio\func_01
DEVPKEY_Device_BaseContainerId:
    VT_CLSID {00000000-0000-0000-ffff-ffffffffffff}
DEVPKEY_Device_ContainerId:
    VT_CLSID {00000000-0000-0000-ffff-ffffffffffff}
DEVPKEY_Device_EnumeratorName:
    VT_LPWSTR HDAUDIO
{b3f8fa53-0004-438e-9003-51a46e139bfc},1:
    VT_BLOB of size 72
    a8 7f a4 d5 98 6d d1 11
    a2 1a 00 a0 c9 22 31 96
    9c ac 97 dc ec dd 59 4d
    b6 50 3b 8b a6 7b c2 a1
    00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00
    e0 cc 13 de 04 83 e9 4e
    ba ce 48 24 21 4e 3e a5
    00 00 02 00 01 00 00 00
PKEY_AudioEndpoint_FormFactor:
    VT_UI4 10
PKEY_AudioEndpoint_JackSubType:
    VT_LPWSTR {6994AD04-93EF-11D0-A3CC-00A0C9223196}
DEVPKEY_DeviceClass_IconPath:
    VT_LPWSTR %windir%\system32\mmres.dll,-3018
{840b8171-b0ad-410f-8581-cccc0382cfef},0:
    VT_BLOB of size 300
    01 00 00 00 28 01 00 00
    00 00 01 00 7b 00 32 00
    7d 00 2e 00 5c 00 5c 00
    3f 00 5c 00 68 00 64 00
    61 00 75 00 64 00 69 00
    6f 00 23 00 66 00 75 00
    6e 00 63 00 5f 00 30 00
    31 00 26 00 76 00 65 00
    6e 00 5f 00 38 00 33 00
    38 00 34 00 26 00 64 00
    65 00 76 00 5f 00 37 00
    36 00 39 00 30 00 26 00
    73 00 75 00 62 00 73 00
    79 00 73 00 5f 00 31 00
    30 00 32 00 38 00 30 00
    31 00 62 00 64 00 26 00
    72 00 65 00 76 00 5f 00
    31 00 30 00 32 00 32 00
    23 00 34 00 26 00 33 00
    33 00 64 00 30 00 34 00
    34 00 66 00 65 00 26 00
    30 00 26 00 30 00 30 00
    30 00 31 00 23 00 7b 00
    36 00 39 00 39 00 34 00
    61 00 64 00 30 00 34 00
    2d 00 39 00 33 00 65 00
    66 00 2d 00 31 00 31 00
    64 00 30 00 2d 00 61 00
    33 00 63 00 63 00 2d 00
    30 00 30 00 61 00 30 00
    63 00 39 00 32 00 32 00
    33 00 31 00 39 00 36 00
    7d 00 5c 00 65 00 6d 00
    69 00 63 00 69 00 6e 00
    74 00 6f 00 70 00 6f 00
    2f 00 30 00 30 00 30 00
    31 00 30 00 30 00 30 00
    30 00 00 00
PKEY_AudioEndpoint_Association:
    VT_LPWSTR {00000000-0000-0000-0000-000000000000}
PKEY_AudioEndpoint_Supports_EventDriven_Mode:
    VT_UI4 1
DEVPKEY_Device_FriendlyName:
    VT_LPWSTR Internal AUX Jack (High Definition Audio Device)
DEVPKEY_DeviceInterface_FriendlyName:
    VT_LPWSTR High Definition Audio Device
PKEY_AudioEndpoint_GUID:
    VT_LPWSTR {6D531641-B3E3-43C5-BA56-BA165B4A9BB6}

ID: {0.0.0.00000000}.{ca9fa848-1e60-401c-81e6-323546335d0a}
State: 1 (DEVICE_STATE_ACTIVE)
-- Properties (26) --
{b3f8fa53-0004-438e-9003-51a46e139bfc},15:
    VT_BLOB of size 16
    da 07 0a 00 04 00 1c 00
    16 00 3a 00 3a 00 d1 00
DEVPKEY_Device_DeviceDesc:
    VT_LPWSTR Speakers
{b3f8fa53-0004-438e-9003-51a46e139bfc},6:
    VT_LPWSTR High Definition Audio Device
{b3f8fa53-0004-438e-9003-51a46e139bfc},2:
    VT_LPWSTR {1}.HDAUDIO\FUNC_01&VEN_8384&DEV_7690&SUBSYS_102801BD&REV_1022\4&33D044FE&0&0001
{83da6326-97a6-4088-9453-a1923f573b29},3:
    VT_LPWSTR hdaudio.inf:Microsoft.ntamd64:HdAudModel:6.1.7600.16385::hdaudio\func_01
DEVPKEY_Device_BaseContainerId:
    VT_CLSID {00000000-0000-0000-ffff-ffffffffffff}
DEVPKEY_Device_ContainerId:
    VT_CLSID {00000000-0000-0000-ffff-ffffffffffff}
DEVPKEY_Device_EnumeratorName:
    VT_LPWSTR HDAUDIO
{b3f8fa53-0004-438e-9003-51a46e139bfc},1:
    VT_BLOB of size 72
    a8 7f a4 d5 98 6d d1 11
    a2 1a 00 a0 c9 22 31 96
    9c ac 97 dc ec dd 59 4d
    b6 50 3b 8b a6 7b c2 a1
    00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00
    e0 cc 13 de 04 83 e9 4e
    ba ce 48 24 21 4e 3e a5
    00 00 02 00 01 00 00 00
PKEY_AudioEndpoint_FormFactor:
    VT_UI4 1
PKEY_AudioEndpoint_JackSubType:
    VT_LPWSTR {DFF21CE1-F70F-11D0-B917-00A0C9223196}
DEVPKEY_DeviceClass_IconPath:
    VT_LPWSTR %windir%\system32\mmres.dll,-3010
{840b8171-b0ad-410f-8581-cccc0382cfef},0:
    VT_BLOB of size 324
    01 00 00 00 40 01 00 00
    00 00 01 00 7b 00 32 00
    7d 00 2e 00 5c 00 5c 00
    3f 00 5c 00 68 00 64 00
    61 00 75 00 64 00 69 00
    6f 00 23 00 66 00 75 00
    6e 00 63 00 5f 00 30 00
    31 00 26 00 76 00 65 00
    6e 00 5f 00 38 00 33 00
    38 00 34 00 26 00 64 00
    65 00 76 00 5f 00 37 00
    36 00 39 00 30 00 26 00
    73 00 75 00 62 00 73 00
    79 00 73 00 5f 00 31 00
    30 00 32 00 38 00 30 00
    31 00 62 00 64 00 26 00
    72 00 65 00 76 00 5f 00
    31 00 30 00 32 00 32 00
    23 00 34 00 26 00 33 00
    33 00 64 00 30 00 34 00
    34 00 66 00 65 00 26 00
    30 00 26 00 30 00 30 00
    30 00 31 00 23 00 7b 00
    36 00 39 00 39 00 34 00
    61 00 64 00 30 00 34 00
    2d 00 39 00 33 00 65 00
    66 00 2d 00 31 00 31 00
    64 00 30 00 2d 00 61 00
    33 00 63 00 63 00 2d 00
    30 00 30 00 61 00 30 00
    63 00 39 00 32 00 32 00
    33 00 31 00 39 00 36 00
    7d 00 5c 00 65 00 73 00
    6c 00 61 00 76 00 65 00
    64 00 68 00 70 00 73 00
    70 00 65 00 61 00 6b 00
    65 00 72 00 74 00 6f 00
    70 00 6f 00 2f 00 30 00
    30 00 30 00 31 00 30 00
    30 00 30 00 31 00 00 00
    00 00 00 00
PKEY_AudioEndpoint_Association:
    VT_LPWSTR {00000000-0000-0000-0000-000000000000}
PKEY_AudioEndpoint_Supports_EventDriven_Mode:
    VT_UI4 1
{9a82a7db-3ebb-41b4-83ba-18b7311718fc},1:
    VT_UI4 65536
{233164c8-1b2c-4c7d-bc68-b671687a2567},1:
    VT_LPWSTR {2}.\\?\hdaudio#func_01&ven_8384&dev_7690&subsys_102801bd&rev_1022#4&33d044fe&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\eslavedhpspeakerwave
{5a9125b7-f367-4924-ace2-0803a4a3a471},0:
    VT_UI4 1610652916
{5a9125b7-f367-4924-ace2-0803a4a3a471},2:
    VT_UI4 1610644836
{b3f8fa53-0004-438e-9003-51a46e139bfc},0:
    VT_UI4 1
PKEY_AudioEngine_DeviceFormat:
    VT_BLOB of size 40
    fe ff 02 00 44 ac 00 00
    10 b1 02 00 04 00 10 00
    16 00 10 00 03 00 00 00
    01 00 00 00 00 00 10 00
    80 00 00 aa 00 38 9b 71
{e4870e26-3cc5-4cd2-ba46-ca0a9a70ed04},0:
    VT_BLOB of size 40
    fe ff 02 00 44 ac 00 00
    20 62 05 00 08 00 20 00
    16 00 20 00 03 00 00 00
    03 00 00 00 00 00 10 00
    80 00 00 aa 00 38 9b 71
{e4870e26-3cc5-4cd2-ba46-ca0a9a70ed04},1:
    VT_BLOB of size 8
    d3 8c 01 00 00 00 00 00
DEVPKEY_Device_FriendlyName:
    VT_LPWSTR Speakers (High Definition Audio Device)
DEVPKEY_DeviceInterface_FriendlyName:
    VT_LPWSTR High Definition Audio Device
PKEY_AudioEndpoint_GUID:
    VT_LPWSTR {CA9FA848-1E60-401C-81E6-323546335D0A}

ID: {0.0.1.00000000}.{4f5e42d9-227f-43ff-bf5b-a1ce5d0324cf}
State: 8 (DEVICE_STATE_UNPLUGGED)
-- Properties (28) --
{b3f8fa53-0004-438e-9003-51a46e139bfc},15:
    VT_BLOB of size 16
    da 07 0a 00 04 00 1c 00
    16 00 3a 00 3a 00 0f 01
DEVPKEY_Device_DeviceDesc:
    VT_LPWSTR Microphone
{b3f8fa53-0004-438e-9003-51a46e139bfc},6:
    VT_LPWSTR High Definition Audio Device
{b3f8fa53-0004-438e-9003-51a46e139bfc},2:
    VT_LPWSTR {1}.HDAUDIO\FUNC_01&VEN_8384&DEV_7690&SUBSYS_102801BD&REV_1022\4&33D044FE&0&0001
{83da6326-97a6-4088-9453-a1923f573b29},3:
    VT_LPWSTR hdaudio.inf:Microsoft.ntamd64:HdAudModel:6.1.7600.16385::hdaudio\func_01
DEVPKEY_Device_BaseContainerId:
    VT_CLSID {00000000-0000-0000-ffff-ffffffffffff}
DEVPKEY_Device_ContainerId:
    VT_CLSID {00000000-0000-0000-ffff-ffffffffffff}
DEVPKEY_Device_EnumeratorName:
    VT_LPWSTR HDAUDIO
{b3f8fa53-0004-438e-9003-51a46e139bfc},1:
    VT_BLOB of size 72
    a8 7f a4 d5 98 6d d1 11
    a2 1a 00 a0 c9 22 31 96
    9c ac 97 dc ec dd 59 4d
    b6 50 3b 8b a6 7b c2 a1
    00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00
    e0 cc 13 de 04 83 e9 4e
    ba ce 48 24 21 4e 3e a5
    00 00 02 00 01 00 00 00
PKEY_AudioEndpoint_FormFactor:
    VT_UI4 4
PKEY_AudioEndpoint_JackSubType:
    VT_LPWSTR {DFF21BE1-F70F-11D0-B917-00A0C9223196}
DEVPKEY_DeviceClass_IconPath:
    VT_LPWSTR %windir%\system32\mmres.dll,-3014
{840b8171-b0ad-410f-8581-cccc0382cfef},0:
    VT_BLOB of size 300
    01 00 00 00 28 01 00 00
    00 00 01 00 7b 00 32 00
    7d 00 2e 00 5c 00 5c 00
    3f 00 5c 00 68 00 64 00
    61 00 75 00 64 00 69 00
    6f 00 23 00 66 00 75 00
    6e 00 63 00 5f 00 30 00
    31 00 26 00 76 00 65 00
    6e 00 5f 00 38 00 33 00
    38 00 34 00 26 00 64 00
    65 00 76 00 5f 00 37 00
    36 00 39 00 30 00 26 00
    73 00 75 00 62 00 73 00
    79 00 73 00 5f 00 31 00
    30 00 32 00 38 00 30 00
    31 00 62 00 64 00 26 00
    72 00 65 00 76 00 5f 00
    31 00 30 00 32 00 32 00
    23 00 34 00 26 00 33 00
    33 00 64 00 30 00 34 00
    34 00 66 00 65 00 26 00
    30 00 26 00 30 00 30 00
    30 00 31 00 23 00 7b 00
    36 00 39 00 39 00 34 00
    61 00 64 00 30 00 34 00
    2d 00 39 00 33 00 65 00
    66 00 2d 00 31 00 31 00
    64 00 30 00 2d 00 61 00
    33 00 63 00 63 00 2d 00
    30 00 30 00 61 00 30 00
    63 00 39 00 32 00 32 00
    33 00 31 00 39 00 36 00
    7d 00 5c 00 65 00 6d 00
    69 00 63 00 69 00 6e 00
    74 00 6f 00 70 00 6f 00
    2f 00 30 00 30 00 30 00
    31 00 30 00 30 00 30 00
    31 00 00 00
PKEY_AudioEndpoint_Association:
    VT_LPWSTR {00000000-0000-0000-0000-000000000000}
PKEY_AudioEndpoint_Supports_EventDriven_Mode:
    VT_UI4 1
{24dbb0fc-9311-4b3d-9cf0-18ff155639d4},3:
    VT_BOOL 0xffffffff
{24dbb0fc-9311-4b3d-9cf0-18ff155639d4},4:
    VT_BOOL 0xffffffff
{9a82a7db-3ebb-41b4-83ba-18b7311718fc},1:
    VT_UI4 65536
{233164c8-1b2c-4c7d-bc68-b671687a2567},1:
    VT_LPWSTR {2}.\\?\hdaudio#func_01&ven_8384&dev_7690&subsys_102801bd&rev_1022#4&33d044fe&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\emicinwave
{5a9125b7-f367-4924-ace2-0803a4a3a471},0:
    VT_UI4 1610712932
{5a9125b7-f367-4924-ace2-0803a4a3a471},2:
    VT_UI4 1610708836
{b3f8fa53-0004-438e-9003-51a46e139bfc},0:
    VT_UI4 3
PKEY_AudioEngine_DeviceFormat:
    VT_BLOB of size 40
    fe ff 02 00 44 ac 00 00
    10 b1 02 00 04 00 10 00
    16 00 10 00 03 00 00 00
    01 00 00 00 00 00 10 00
    80 00 00 aa 00 38 9b 71
{e4870e26-3cc5-4cd2-ba46-ca0a9a70ed04},0:
    VT_BLOB of size 40
    fe ff 02 00 44 ac 00 00
    20 62 05 00 08 00 20 00
    16 00 20 00 03 00 00 00
    03 00 00 00 00 00 10 00
    80 00 00 aa 00 38 9b 71
{e4870e26-3cc5-4cd2-ba46-ca0a9a70ed04},1:
    VT_BLOB of size 8
    d3 8c 01 00 00 00 00 00
DEVPKEY_Device_FriendlyName:
    VT_LPWSTR Microphone (High Definition Audio Device)
DEVPKEY_DeviceInterface_FriendlyName:
    VT_LPWSTR High Definition Audio Device
PKEY_AudioEndpoint_GUID:
    VT_LPWSTR {4F5E42D9-227F-43FF-BF5B-A1CE5D0324CF}

ID: {0.0.1.00000000}.{6712184b-f8f0-474d-ad36-808cc90a7cfd}
State: 4 (DEVICE_STATE_NOTPRESENT)
-- Properties (29) --
{b3f8fa53-0004-438e-9003-51a46e139bfc},15:
    VT_BLOB of size 16
    db 07 03 00 01 00 15 00
    10 00 3b 00 21 00 f4 00
DEVPKEY_Device_DeviceDesc:
    VT_LPWSTR Microphone Array
{b3f8fa53-0004-438e-9003-51a46e139bfc},6:
    VT_LPWSTR Microphone Array
{b3f8fa53-0004-438e-9003-51a46e139bfc},2:
    VT_LPWSTR {1}.USB\VID_045E&PID_FFF0&MI_01\6&1474EDB6&0&0001
{83da6326-97a6-4088-9453-a1923f573b29},3:
    VT_LPWSTR wdma_usb.inf:Microsoft.ntamd64:USBAudio:6.1.7600.16385:usb\class_01
DEVPKEY_Device_BaseContainerId:
    VT_CLSID {9132f6ea-a152-5472-8685-61c0d297a30b}
DEVPKEY_Device_ContainerId:
    VT_CLSID {9132f6ea-a152-5472-8685-61c0d297a30b}
DEVPKEY_Device_EnumeratorName:
    VT_LPWSTR USB
{b3f8fa53-0004-438e-9003-51a46e139bfc},1:
    VT_BLOB of size 72
    30 f1 1c 4e 79 16 3b 46
    a7 2f a5 bf 64 c8 6e ba
    4e 5a cd ab 63 c2 3b 46
    a7 2f a5 bf 64 c8 6e ba
    f0 75 12 8f e9 26 64 42
    ba 4d 39 ff f0 1d 94 aa
    a6 54 57 fc f8 2d 3b 46
    a7 2f a5 bf 64 c8 6e ba
    02 00 00 00 09 00 00 00
PKEY_AudioEndpoint_FormFactor:
    VT_UI4 4
PKEY_AudioEndpoint_JackSubType:
    VT_LPWSTR {DFF21BE5-F70F-11D0-B917-00A0C9223196}
DEVPKEY_DeviceClass_IconPath:
    VT_LPWSTR %windir%\system32\mmres.dll,-3020
{840b8171-b0ad-410f-8581-cccc0382cfef},0:
    VT_BLOB of size 236
    01 00 00 00 e8 00 00 00
    00 00 01 00 7b 00 32 00
    7d 00 2e 00 5c 00 5c 00
    3f 00 5c 00 75 00 73 00
    62 00 23 00 76 00 69 00
    64 00 5f 00 30 00 34 00
    35 00 65 00 26 00 70 00
    69 00 64 00 5f 00 66 00
    66 00 66 00 30 00 26 00
    6d 00 69 00 5f 00 30 00
    31 00 23 00 36 00 26 00
    31 00 34 00 37 00 34 00
    65 00 64 00 62 00 36 00
    26 00 30 00 26 00 30 00
    30 00 30 00 31 00 23 00
    7b 00 36 00 39 00 39 00
    34 00 61 00 64 00 30 00
    34 00 2d 00 39 00 33 00
    65 00 66 00 2d 00 31 00
    31 00 64 00 30 00 2d 00
    61 00 33 00 63 00 63 00
    2d 00 30 00 30 00 61 00
    30 00 63 00 39 00 32 00
    32 00 33 00 31 00 39 00
    36 00 7d 00 5c 00 67 00
    6c 00 6f 00 62 00 61 00
    6c 00 2f 00 30 00 30 00
    30 00 31 00 30 00 30 00
    30 00 31 00 00 00 00 00
    00 00 00 00
PKEY_AudioEndpoint_Association:
    VT_LPWSTR {00000000-0000-0000-0000-000000000000}
PKEY_AudioEndpoint_Supports_EventDriven_Mode:
    VT_UI4 1
{24dbb0fc-9311-4b3d-9cf0-18ff155639d4},3:
    VT_BOOL 0x0
{24dbb0fc-9311-4b3d-9cf0-18ff155639d4},4:
    VT_BOOL 0xffffffff
{9a82a7db-3ebb-41b4-83ba-18b7311718fc},1:
    VT_UI4 65536
{233164c8-1b2c-4c7d-bc68-b671687a2567},1:
    VT_LPWSTR {2}.\\?\usb#vid_045e&pid_fff0&mi_01#6&1474edb6&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global
{5a9125b7-f367-4924-ace2-0803a4a3a471},0:
    VT_UI4 1610713736
{5a9125b7-f367-4924-ace2-0803a4a3a471},2:
    VT_UI4 1610709736
{b3f8fa53-0004-438e-9003-51a46e139bfc},0:
    VT_UI4 3
PKEY_AudioEngine_DeviceFormat:
    VT_BLOB of size 40
    fe ff 04 00 80 3e 00 00
    00 f4 01 00 08 00 10 00
    16 00 10 00 00 00 00 00
    01 00 00 00 00 00 10 00
    80 00 00 aa 00 38 9b 71
{e4870e26-3cc5-4cd2-ba46-ca0a9a70ed04},0:
    VT_BLOB of size 40
    fe ff 04 00 80 3e 00 00
    00 e8 03 00 10 00 20 00
    16 00 20 00 00 00 00 00
    03 00 00 00 00 00 10 00
    80 00 00 aa 00 38 9b 71
{e4870e26-3cc5-4cd2-ba46-ca0a9a70ed04},1:
    VT_BLOB of size 8
    a0 86 01 00 00 00 00 00
{9855c4cd-df8c-449c-a181-8191b68bd06c},0:
    VT_BLOB of size 16
    00 00 f0 41 00 00 f0 41
    00 00 f0 41 00 00 f0 41
DEVPKEY_Device_FriendlyName:
    VT_LPWSTR Microphone Array (Microphone Array)
DEVPKEY_DeviceInterface_FriendlyName:
    VT_LPWSTR Microphone Array
PKEY_AudioEndpoint_GUID:
    VT_LPWSTR {6712184B-F8F0-474D-AD36-808CC90A7CFD}

The unrecognized properties could be private properties used by the OS, or by the audio driver, or they might be defined in some public header that I didn’t bother to scour.

UPDATE 2011-09-09: added WAVEFORMATEX logging for properties known to be audio formats.

UPDATE 2015-09-22: moved source to github

2 thoughts on “How to enumerate audio endpoint (IMMDevice) properties on your system

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s