简体   繁体   中英

How to get the Audio Device number from the Audio Device Id?

There is a Windows Form (C#) application which displays the list of Audio Device (Mic Combo and Speaker combo) connected to the system. User can select his input device (Mic) and output device (speaker) preference to speak and hear. There is another platform level code (Written in C Program), which expects the device number to play and listen to appropriate device. This is an integer value(what we call Wave in and Wave out id). This device number value varies when the windows Audio (I/O) device priority is changed. Now my Windows Form UI(C#) needs to send the device number to the Platform code(C language), based on the dropdown selection (MIC / Speaker).

I was able to list devices (Device Names, and Device ID(GUID) in the drop down using below approaches ( DirectXSound / Microsoft Expression Encoder / Wmi query) These gives me unique DeviceId (GUID). However I was unable to get the corresponding device number (Integer value) for the selected input and output audio device.

Is there any Mapping to get the device number (integer) from device Id(GUID)?

I googled a lot and got frustrated.

I believe this link will answer your question. The answer's code is written in C++ but you should be able to port it out fairly easily.

Is it possible to relate the same audio device in different APIs?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM