Walking the IDeviceTopology tree to see audio driver settings
2015-12-31 10:49
190 查看
I've blogged
before about using the IDeviceTopology API to poke around the internal structure exposed by audio drivers.
In particular, given an audio endpoint, you can map out all the knobs and widgets of all the signal paths that feed into that endpoint (for playback) or out of it (for recording.)
A
version of this has been floating around the forums for some years, but I thought I would spiffy it up a little and make a blog post out of it.
Pseudocode:
for each endpoint exposed by IMMDeviceEnumerator:
figure out whether it's a playback endpoint or a recording endpoint
find the IPart which is
the very end of the signal path for a playback endpoint, or
the very beginning for a recording endpoint:
if the IPart advertises jack information, query it
if the IPart is a volume control, query the range and the current setting
if the IPart is a mute control, query the current setting
(we could continue here for various other kinds of controls, but I'm lazy)
for all parts which
feed in to the IPart for a playback endpoint, or
are fed by the IPart for a recording endpoint:
recursively process that IPart
if the IPart is a connector:
find the IPart on the other side of the connection
process it recursively
take care not to immediately hop back to this graph!
Output:
>devicetopology.exe
eRender endpoint
Name: Speakers (High Definition Audio Device)
Endpoint ID: {0.0.0.00000000}.{351933db-e9b5-41df-8fa5-69c3d84531df}
0x10000:
{2}.\\?\hdaudio#func_01&ven_10ec&dev_0262&subsys_103c1309&rev_1002#4&12f2dd06&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\elineouttopo
0x10001: Speakers
Jacks: 1
-- Jack 1 --
ChannelMapping: 0x3
Color: 0x00ff00 (red = 0, green = 255, blue = 0)
Connection Type: 1 (eConnType3Point5mm)
Geometric Location: 1 (eGeoLocRear)
General Location: 0 (eGenLocPrimaryBox)
Port Connection: 0 (ePortConnJack)
IsConnected: No
0x20001: Master Mute
0x20000: Speakers
0x10000:
{0.0.1.00000000}.{6dd94b4a-90d7-4ddc-926d-69312eb53841}
0x10000:
eRender endpoint
Name: Speakers (High Definition Audio Device)
Endpoint ID: {0.0.0.00000000}.{6ce8bdf4-d22f-4ec7-a007-2228540b6705}
0x10000:
{2}.\\?\hdaudio#func_01&ven_10ec&dev_0262&subsys_103c1309&rev_1002#4&12f2dd06&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\elineout2topo
0x10001: Speakers
Jacks: 1
-- Jack 1 --
ChannelMapping: 0x3
Color: 0x000000 (red = 0, green = 0, blue = 0)
Connection Type: 3 (eConnTypeAtapiInternal)
Geometric Location: 13 (eGeoLocATAPI)
General Location: 0 (eGenLocPrimaryBox)
Port Connection: 1 (ePortConnIntegratedDevice)
IsConnected: Yes
0x20001: Master Mute
Mute node: MUTED
0x20000: Speakers
Channel 0 volume, -46.5 dB to 0 dB in steps of 1.5 dB: -6 dB
0x10000:
{2}.\\?\hdaudio#func_01&ven_10ec&dev_0262&subsys_103c1309&rev_1002#4&12f2dd06&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\elineout2wave
0x10001:
0x20000: HD Audio line out
0x10000: PC Speaker
eRender endpoint
Name: Speakerphone (USB Audio Device)
Endpoint ID: {0.0.0.00000000}.{916afdff-2ba3-4a7f-bca9-0bf75c47c946}
0x10000:
{2}.\\?\usb#vid_095d&pid_0005&mi_00#7&335bfb1&0&0000#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global
0x10003: Speakerphone
0x20009: DAC
0x20008: Volume
Channel 0 volume, -30.0039 dB to 0 dB in steps of 0.5 dB: -17.747 dB
0x20007: Mute
Mute node: NOT MUTED
0x20006: Sample Rate Converter
0x10000:
eCapture endpoint
Name: Microphone (High Definition Audio Device)
Endpoint ID: {0.0.1.00000000}.{38178e43-ed21-4731-b8f0-1330c3b1cd0a}
0x10000:
{2}.\\?\hdaudio#func_01&ven_10ec&dev_0262&subsys_103c1309&rev_1002#4&12f2dd06&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\emixedcapturetopo
0x10001: Microphone
Jacks: 1
-- Jack 1 --
ChannelMapping: 0x0
Color: 0xff80c0 (red = 255, green = 128, blue = 192)
Connection Type: 1 (eConnType3Point5mm)
Geometric Location: 1 (eGeoLocRear)
General Location: 0 (eGenLocPrimaryBox)
Port Connection: 0 (ePortConnJack)
IsConnected: No
0x20001: Microphone
0x20002: Microphone
0x20003: Microphone Boost
0x20000: Sum
0x10000:
{0.0.0.00000000}.{f7bf26d7-89a3-4049-8cd3-8148a6615565}
0x10000:
eCapture endpoint
Name: Speakerphone (USB Audio Device)
Endpoint ID: {0.0.1.00000000}.{a21f51bc-5d0b-47af-93b6-ef9a968bb8ff}
0x10000:
{2}.\\?\usb#vid_095d&pid_0005&mi_00#7&335bfb1&0&0000#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global
0x10002: Speakerphone
0x20000: ADC
0x20001: Mute
Mute node: NOT MUTED
0x20002: Volume
Channel 0 volume, 0 dB to 32 dB in steps of 0.5 dB: 29 dB
0x20003: SuperMix
0x20004:
0x20005: Sample Rate Converter
0x10001:
eCapture endpoint
Name: Microphone (High Definition Audio Device)
Endpoint ID: {0.0.1.00000000}.{a9d04431-a99f-4ebe-b995-33f0d027559c}
0x10000:
{2}.\\?\hdaudio#func_01&ven_10ec&dev_0262&subsys_103c1309&rev_1002#4&12f2dd06&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\emixedcapturetopo
0x10002: Microphone
Jacks: 1
-- Jack 1 --
ChannelMapping: 0x0
Color: 0x000000 (red = 0, green = 0, blue = 0)
Connection Type: 1 (eConnType3Point5mm)
Geometric Location: 2 (eGeoLocFront)
General Location: 0 (eGenLocPrimaryBox)
Port Connection: 0 (ePortConnJack)
IsConnected: No
0x20004: Microphone
0x20005: Microphone
0x20006: Microphone Boost
0x20000: Sum
0x10000:
{0.0.0.00000000}.{f7bf26d7-89a3-4049-8cd3-8148a6615565}
0x10000:
eCapture endpoint
Name: Line In (High Definition Audio Device)
Endpoint ID: {0.0.1.00000000}.{bbf7eb42-7674-4a35-ad02-b723ea047dac}
0x10000:
{2}.\\?\hdaudio#func_01&ven_10ec&dev_0262&subsys_103c1309&rev_1002#4&12f2dd06&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\emixedcapturetopo
0x10003: Line In
Jacks: 1
-- Jack 1 --
ChannelMapping: 0x0
Color: 0x0000ff (red = 0, green = 0, blue = 255)
Connection Type: 1 (eConnType3Point5mm)
Geometric Location: 1 (eGeoLocRear)
General Location: 0 (eGenLocPrimaryBox)
Port Connection: 0 (ePortConnJack)
IsConnected: No
0x20007: Line In
0x20008: Line In
0x20000: Sum
0x10000:
{0.0.0.00000000}.{f7bf26d7-89a3-4049-8cd3-8148a6615565}
0x10000:
And here's a screenshot of the Windows Driver
Kit's Kernel Streaming Studio showing the topology exposed
by the audio drivers on my machine:
Source and x86/amd64 binaries attached.
EDIT September 22 2015: moved source to github https://github.com/mvaneerde/blog/tree/master/devicetopology
devicetopology.zip
Audio, Win32
http://blogs.msdn.com/b/matthew_van_eerde/archive/2014/11/20/walking-the-idevicetopology-tree-to-see-audio-driver-settings.aspx
before about using the IDeviceTopology API to poke around the internal structure exposed by audio drivers.
In particular, given an audio endpoint, you can map out all the knobs and widgets of all the signal paths that feed into that endpoint (for playback) or out of it (for recording.)
A
version of this has been floating around the forums for some years, but I thought I would spiffy it up a little and make a blog post out of it.
Pseudocode:
for each endpoint exposed by IMMDeviceEnumerator:
figure out whether it's a playback endpoint or a recording endpoint
find the IPart which is
the very end of the signal path for a playback endpoint, or
the very beginning for a recording endpoint:
if the IPart advertises jack information, query it
if the IPart is a volume control, query the range and the current setting
if the IPart is a mute control, query the current setting
(we could continue here for various other kinds of controls, but I'm lazy)
for all parts which
feed in to the IPart for a playback endpoint, or
are fed by the IPart for a recording endpoint:
recursively process that IPart
if the IPart is a connector:
find the IPart on the other side of the connection
process it recursively
take care not to immediately hop back to this graph!
Output:
>devicetopology.exe
eRender endpoint
Name: Speakers (High Definition Audio Device)
Endpoint ID: {0.0.0.00000000}.{351933db-e9b5-41df-8fa5-69c3d84531df}
0x10000:
{2}.\\?\hdaudio#func_01&ven_10ec&dev_0262&subsys_103c1309&rev_1002#4&12f2dd06&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\elineouttopo
0x10001: Speakers
Jacks: 1
-- Jack 1 --
ChannelMapping: 0x3
Color: 0x00ff00 (red = 0, green = 255, blue = 0)
Connection Type: 1 (eConnType3Point5mm)
Geometric Location: 1 (eGeoLocRear)
General Location: 0 (eGenLocPrimaryBox)
Port Connection: 0 (ePortConnJack)
IsConnected: No
0x20001: Master Mute
0x20000: Speakers
0x10000:
{0.0.1.00000000}.{6dd94b4a-90d7-4ddc-926d-69312eb53841}
0x10000:
eRender endpoint
Name: Speakers (High Definition Audio Device)
Endpoint ID: {0.0.0.00000000}.{6ce8bdf4-d22f-4ec7-a007-2228540b6705}
0x10000:
{2}.\\?\hdaudio#func_01&ven_10ec&dev_0262&subsys_103c1309&rev_1002#4&12f2dd06&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\elineout2topo
0x10001: Speakers
Jacks: 1
-- Jack 1 --
ChannelMapping: 0x3
Color: 0x000000 (red = 0, green = 0, blue = 0)
Connection Type: 3 (eConnTypeAtapiInternal)
Geometric Location: 13 (eGeoLocATAPI)
General Location: 0 (eGenLocPrimaryBox)
Port Connection: 1 (ePortConnIntegratedDevice)
IsConnected: Yes
0x20001: Master Mute
Mute node: MUTED
0x20000: Speakers
Channel 0 volume, -46.5 dB to 0 dB in steps of 1.5 dB: -6 dB
0x10000:
{2}.\\?\hdaudio#func_01&ven_10ec&dev_0262&subsys_103c1309&rev_1002#4&12f2dd06&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\elineout2wave
0x10001:
0x20000: HD Audio line out
0x10000: PC Speaker
eRender endpoint
Name: Speakerphone (USB Audio Device)
Endpoint ID: {0.0.0.00000000}.{916afdff-2ba3-4a7f-bca9-0bf75c47c946}
0x10000:
{2}.\\?\usb#vid_095d&pid_0005&mi_00#7&335bfb1&0&0000#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global
0x10003: Speakerphone
0x20009: DAC
0x20008: Volume
Channel 0 volume, -30.0039 dB to 0 dB in steps of 0.5 dB: -17.747 dB
0x20007: Mute
Mute node: NOT MUTED
0x20006: Sample Rate Converter
0x10000:
eCapture endpoint
Name: Microphone (High Definition Audio Device)
Endpoint ID: {0.0.1.00000000}.{38178e43-ed21-4731-b8f0-1330c3b1cd0a}
0x10000:
{2}.\\?\hdaudio#func_01&ven_10ec&dev_0262&subsys_103c1309&rev_1002#4&12f2dd06&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\emixedcapturetopo
0x10001: Microphone
Jacks: 1
-- Jack 1 --
ChannelMapping: 0x0
Color: 0xff80c0 (red = 255, green = 128, blue = 192)
Connection Type: 1 (eConnType3Point5mm)
Geometric Location: 1 (eGeoLocRear)
General Location: 0 (eGenLocPrimaryBox)
Port Connection: 0 (ePortConnJack)
IsConnected: No
0x20001: Microphone
0x20002: Microphone
0x20003: Microphone Boost
0x20000: Sum
0x10000:
{0.0.0.00000000}.{f7bf26d7-89a3-4049-8cd3-8148a6615565}
0x10000:
eCapture endpoint
Name: Speakerphone (USB Audio Device)
Endpoint ID: {0.0.1.00000000}.{a21f51bc-5d0b-47af-93b6-ef9a968bb8ff}
0x10000:
{2}.\\?\usb#vid_095d&pid_0005&mi_00#7&335bfb1&0&0000#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global
0x10002: Speakerphone
0x20000: ADC
0x20001: Mute
Mute node: NOT MUTED
0x20002: Volume
Channel 0 volume, 0 dB to 32 dB in steps of 0.5 dB: 29 dB
0x20003: SuperMix
0x20004:
0x20005: Sample Rate Converter
0x10001:
eCapture endpoint
Name: Microphone (High Definition Audio Device)
Endpoint ID: {0.0.1.00000000}.{a9d04431-a99f-4ebe-b995-33f0d027559c}
0x10000:
{2}.\\?\hdaudio#func_01&ven_10ec&dev_0262&subsys_103c1309&rev_1002#4&12f2dd06&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\emixedcapturetopo
0x10002: Microphone
Jacks: 1
-- Jack 1 --
ChannelMapping: 0x0
Color: 0x000000 (red = 0, green = 0, blue = 0)
Connection Type: 1 (eConnType3Point5mm)
Geometric Location: 2 (eGeoLocFront)
General Location: 0 (eGenLocPrimaryBox)
Port Connection: 0 (ePortConnJack)
IsConnected: No
0x20004: Microphone
0x20005: Microphone
0x20006: Microphone Boost
0x20000: Sum
0x10000:
{0.0.0.00000000}.{f7bf26d7-89a3-4049-8cd3-8148a6615565}
0x10000:
eCapture endpoint
Name: Line In (High Definition Audio Device)
Endpoint ID: {0.0.1.00000000}.{bbf7eb42-7674-4a35-ad02-b723ea047dac}
0x10000:
{2}.\\?\hdaudio#func_01&ven_10ec&dev_0262&subsys_103c1309&rev_1002#4&12f2dd06&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\emixedcapturetopo
0x10003: Line In
Jacks: 1
-- Jack 1 --
ChannelMapping: 0x0
Color: 0x0000ff (red = 0, green = 0, blue = 255)
Connection Type: 1 (eConnType3Point5mm)
Geometric Location: 1 (eGeoLocRear)
General Location: 0 (eGenLocPrimaryBox)
Port Connection: 0 (ePortConnJack)
IsConnected: No
0x20007: Line In
0x20008: Line In
0x20000: Sum
0x10000:
{0.0.0.00000000}.{f7bf26d7-89a3-4049-8cd3-8148a6615565}
0x10000:
And here's a screenshot of the Windows Driver
Kit's Kernel Streaming Studio showing the topology exposed
by the audio drivers on my machine:
Source and x86/amd64 binaries attached.
EDIT September 22 2015: moved source to github https://github.com/mvaneerde/blog/tree/master/devicetopology
devicetopology.zip
Audio, Win32
http://blogs.msdn.com/b/matthew_van_eerde/archive/2014/11/20/walking-the-idevicetopology-tree-to-see-audio-driver-settings.aspx
相关文章推荐
- java_tomcat部署
- 从零开始学习OpenGL ES之一 – 基本概念
- 用securecrt同时操作多台服务器
- 坐标系、变换及缓冲区及操作矩阵的通用变换函数(openGL)
- linux应用开发相关知识点
- HBase 系统架构
- linux内核驱动02-module param
- 上传文件 nginx 413错误
- 12月国内网站流量统计5强:360安全中心后来居上
- shell 参数
- linux-mysql 连接1
- 在Apache上安装mod_wsgi
- Java爬虫实战(二):抓取一个视频网站上2015年所有电影的下载链接
- Linux 动态库,静态库
- 如何查看linux是32位还是64位
- Linux下安装Matlab2014a及破解
- 值得多逛逛的技术网站
- nginx
- 如何用PHP开发一个完整的网站 多人开发
- CentOs svn服务器安装