0
\$\begingroup\$

I wanted to allow my users to choose the devices that they want to capture from and output to. For this, I used DirectSound device and capture device enumeration functions, obtained GUIDs of all available devices, and arrived at the following lists (DirectSound's grammar preserved):

Primary Sound Driver
Speakers (Realtek High Definition Audio)

Primary Sound Capture Driver
Mic in at front panel (black) (

However when I proceed to create sound capture and output devices, they only work if I supply the GUID of the primary drivers. If I supply Speakers or Mic, the result is always

No sound driver is available for use, or the given GUID is not a valid DirectSound device ID.

My thinking was that since the list of devices is returned to me by DirectSound system, then each GUID should be valid for capture or output, respectively. What am I missing?

\$\endgroup\$
5
  • \$\begingroup\$ If you don't get an answer here, you might have more luck on Stack Overflow. \$\endgroup\$
    – user253751
    Oct 9, 2020 at 11:50
  • \$\begingroup\$ It's been a while since I touched DirectSound API. When creating the device are you flagging them as SHARED or EXCLUSIVE? IIRC Only primary devices can be accessed as EXCLUSIVE (and even then user may not have permission to so a second fallback attempt with SHARED should be done). \$\endgroup\$ Oct 9, 2020 at 14:28
  • \$\begingroup\$ Unless you are using an ancient version of Windows, a better option for audio capture is to use WASAPI. See this sample--the audio code will work for Win32 not just UWP. \$\endgroup\$ Oct 9, 2020 at 19:09
  • \$\begingroup\$ Yes,I am aware of the current state of things. This has to run on XP. When running on 7+ WASAPI will be used. But thanks for the thought. \$\endgroup\$
    – user144176
    Oct 10, 2020 at 23:12
  • \$\begingroup\$ @StephaneHockenhull Using shared but regardless, the same error either way. \$\endgroup\$
    – user144176
    Oct 10, 2020 at 23:12

0

You must log in to answer this question.

Browse other questions tagged .