Juce is a multiplatform application framework (http://www.rawmaterialsoftware.com).
Currently the audio implementation for WASAPI and DirectSound input and output is flawed. It treats each stereo channel as an individual device. As only one input and output device can be selected at a time, this makes outputting to more than one stereo channel simultaneously impossible. A single device such as the FireFace 400, show up as many individual devices of one stereo channel each (for example Analog 1+2, Analog 3+4, Analog 5+6, ADAT 1+2, ADAT 3+4, etc…), instead of one device with many input and output channels.
Juce correctly implements the ASIO interface. When an ASIO device is selected, all of its inputs and outputs are correctly enumerated by the library.
This job is to modify the WASAPI and DirectSound implementations (which are Windows-specific) to correctly identify individual devices, and treat their end points as a set of available channels rather than separate devices.
Here are some screenshots of a third party program, and a Juce program, to illustrate this behavior:
The correct approach is to group multiple endpoints with the same hardware device ID as one. These endpoints can be identified because they all have the same PKEY_DeviceInterface_FriendlyName (but different PKEY_Device_DeviceDesc)
After selecting a group, the list of available channels is created by enumerating all endpoints with the corresponding PKEY_DeviceInterface_FriendlyName. In this screenshot, the text of each channel comes from the value retrieved using PKEY_Device_DeviceDesc.
Unfortunately, Juce treats each endpoint as if it was a separate hardware device, and displays the PKEY_Device_FriendlyName instead. This is what it looks like:
All of these problems exist for DirectSound as well. Here is a small sketch of the changes that need to be made:
[quote=“Vinnie”]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:
- Change WASAPIAudioIODeviceType to allow for an array of active endpoints for both input and output
- Modify scanForDevices() to identify unique instances of the PKEY_DeviceInterface_FriendlyName and treat the whole set of endpoints as a single device
- 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
- Change the input and output channel names to use PKEY_Device_DeviceDesc instead of PKEY_Device_FriendlyName[/quote]