gpt4 book ai didi

c++ - 如何检查麦克风和扬声器是否来自同一个声卡?

转载 作者:可可西里 更新时间:2023-11-01 13:27:15 24 4
gpt4 key购买 nike

我的问题是如何在 Windows 平台上检查麦克风和扬声器是否来自同一个声卡。如果它们来自不同的卡,那么处理时序的逻辑就会不同。我同时使用 DSound 和 WMME API。

最佳答案

WMI 确实提供了一些关于声卡的信息。我还没有弄清楚的是它的付出是否足够。使用“WMI Code Creator”,以下脚本列出了 Win32_SoundDevice 的所有内容对象存储:

strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_SoundDevice",,48)
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "Win32_SoundDevice instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "Availability: " & objItem.Availability
Wscript.Echo "Caption: " & objItem.Caption
Wscript.Echo "ConfigManagerErrorCode: " & objItem.ConfigManagerErrorCode
Wscript.Echo "ConfigManagerUserConfig: " & objItem.ConfigManagerUserConfig
Wscript.Echo "CreationClassName: " & objItem.CreationClassName
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "DeviceID: " & objItem.DeviceID
Wscript.Echo "DMABufferSize: " & objItem.DMABufferSize
Wscript.Echo "ErrorCleared: " & objItem.ErrorCleared
Wscript.Echo "ErrorDescription: " & objItem.ErrorDescription
Wscript.Echo "InstallDate: " & objItem.InstallDate
Wscript.Echo "LastErrorCode: " & objItem.LastErrorCode
Wscript.Echo "Manufacturer: " & objItem.Manufacturer
Wscript.Echo "MPU401Address: " & objItem.MPU401Address
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "PNPDeviceID: " & objItem.PNPDeviceID
If isNull(objItem.PowerManagementCapabilities) Then
Wscript.Echo "PowerManagementCapabilities: "
Else
Wscript.Echo "PowerManagementCapabilities: " & Join(objItem.PowerManagementCapabilities, ",")
End If
Wscript.Echo "PowerManagementSupported: " & objItem.PowerManagementSupported
Wscript.Echo "ProductName: " & objItem.ProductName
Wscript.Echo "Status: " & objItem.Status
Wscript.Echo "StatusInfo: " & objItem.StatusInfo
Wscript.Echo "SystemCreationClassName: " & objItem.SystemCreationClassName
Wscript.Echo "SystemName: " & objItem.SystemName
Next

在我的笔记本电脑上运行可以得到

-----------------------------------
Win32_SoundDevice instance
-----------------------------------
Availability:
Caption: ATI Function Driver for High Definition Audio - ATI AA01
ConfigManagerErrorCode: 0
ConfigManagerUserConfig: False
CreationClassName: Win32_SoundDevice
Description: ATI Function Driver for High Definition Audio - ATI AA01
DeviceID: HDAUDIO\FUNC_01&VEN_1002&DEV_AA01&SUBSYS_00AA0100&REV_1000\5&BB7E0F3&0&0001
DMABufferSize:
ErrorCleared:
ErrorDescription:
InstallDate:
LastErrorCode:
Manufacturer: ATI
MPU401Address:
Name: ATI Function Driver for High Definition Audio - ATI AA01
PNPDeviceID: HDAUDIO\FUNC_01&VEN_1002&DEV_AA01&SUBSYS_00AA0100&REV_1000\5&BB7E0F3&0&0001
PowerManagementCapabilities:
PowerManagementSupported: False
ProductName: ATI Function Driver for High Definition Audio - ATI AA01
Status: OK
StatusInfo: 3
SystemCreationClassName: Win32_ComputerSystem
SystemName: BABEL
-----------------------------------
Win32_SoundDevice instance
-----------------------------------
Availability:
Caption: Conexant High Definition SmartAudio 221
ConfigManagerErrorCode: 0
ConfigManagerUserConfig: False
CreationClassName: Win32_SoundDevice
Description: Conexant High Definition SmartAudio 221
DeviceID: HDAUDIO\FUNC_01&VEN_14F1&DEV_5051&SUBSYS_1179FF5B&REV_1000\4&2DBDAC14&0&0001
DMABufferSize:
ErrorCleared:
ErrorDescription:
InstallDate:
LastErrorCode:
Manufacturer: Conexant
MPU401Address:
Name: Conexant High Definition SmartAudio 221
PNPDeviceID: HDAUDIO\FUNC_01&VEN_14F1&DEV_5051&SUBSYS_1179FF5B&REV_1000\4&2DBDAC14&0&0001
PowerManagementCapabilities:
PowerManagementSupported: False
ProductName: Conexant High Definition SmartAudio 221
Status: OK
StatusInfo: 3
SystemCreationClassName: Win32_ComputerSystem
SystemName: BABEL

我不知道里面有没有什么有用的。这是一个棘手的问题。

关于c++ - 如何检查麦克风和扬声器是否来自同一个声卡?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/404995/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com