WASAPI: Not just for 2 channels anymore

Alright upon further investigation I believe that the following is true:

  • Under WASAPI, each stereo pair belonging to a hardware device appears as its own audio endpoint
  • Juce currently only implements one audio endpoint for output, and one endpoint for input


  • Juce cannot output more than 2 channels at a time in WASAPI

I poked around the WASAPI calls and traced these values for the first endpoint in my Fireface 400 setup:

GetValue (PKEY_Device_FriendlyName,…) == "Speakers (RME Fireface 400)"
GetValue (PKEY_Device_DeviceDesc,…) == “Speakers”


GetValue (PKEY_DeviceInterface_FriendlyName,…) == “RME Fireface 400”

So here is what I am thinking needs to be done, so far:

  1. Change WASAPIAudioIODeviceType to allow for an array of active endpoints for both input and output
  2. Modify scanForDevices() to identify unique instances of the PKEY_DeviceInterface_FriendlyName and treat the whole set of endpoints as a single device
  3. Add code to build a list of input or output channels for a given PKEY_DeviceInterface_FriendlyName by enumerating all the endpoints, collecting the ones that match
  4. Change the input and output channel names to use PKEY_Device_DeviceDesc instead of PKEY_Device_FriendlyName

How does this sound Jules?

Is there anyone with knowledge that can chime in and let me know if I’m going in the right direction? I don’t want to waste my time on a dead end because this WASAPI COM interface is really bulky and clumsy to work with…

Yeah, that does sound like you’re thinking in the right direction. Making it handle multiple in + out devices could be quite a complicated process though, which is probably why I didn’t do it like that originally!

I would check PortAudio implementation if I were you.


[quote=“otristan”]I would check PortAudio implementation if I were you.


LOL its funny that you mention that because…the portaudio developers were asking the same question as me, on their mailing list! How the heck to enumerate the channels for a given device in WASAPI? But I’m going to have a look at it, thanks.

DirectSound suffers the same problem, it treats each stereo pair as a different device, so no multichannel output :frowning: