Need WASAPI fix


#1

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.

UPDATE

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)

[attachment=1]1.jpg[/attachment]

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.

[attachment=0]2.jpg[/attachment]

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:

[attachment=2]3.jpg[/attachment]

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

Therefore

  • 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”

and

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[/quote]

#2

I would immediately have done it if I was a WASAPI/DirectSound expert, but I’m not.


#3

NO one responded to my elance job posting either, India, Pakistan, Russia, etc… no one.


#4

I would try on the PortAudio ML

HTH


#5

I m willing to do it…Please send me a mail regarding this.


#6

Is there anything in the original post that is unclear ??


#7

I Updated the original post to include screenshots, and some more description of the technical details.


#8

Let me add that debugging using the ASIO driver instead of WASAPI (which I would prefer) is REALLY ANNOYING because when my app crashes, or if I force-terminate, I usually have to power cycle the audio device and also my music player stops working, I have to close all my porn and youtube browser instances, and 20% of the time the system is left in a condition that requires a reboot.

I would LOVE to be able to use WASAPI because a crash in shared mode does not disturb the rest of the apps that are using audio resources.

To be clear, the Juce ASIO implementation works perfectly from the standpoint of being able to correctly enumerate distinct ASIO devices, and then further distinguish the individual channels belonging to a particular device.


#9

[quote]

  • Under WASAPI, each stereo pair belonging to a hardware device appears as its own audio endpoint[/quote]

mmh not sure if its helpful, but with my 30€ china-interface (http://trust.com/products/product.aspx?artnr=14134) i can use 6 stereo channels simultaneously with WASAPI (so its maybe a more driver related issue?)

[attachment=0]interface.png[/attachment]


#10

Whoa…I have to study juce_win32_WASAPI.cpp and see how this is possible because I’m getting something different!

On a side note that’s a pretty nice multi-channel interface, what’s the highest sample rate and lowest buffer size you can sustain?


#11

did not checked yet (bought today), i even was suprised that it just works, also with Windows 7 64bit :slight_smile:
If you buy one, please be careful there different hardware revisions, only the new ones seem to have Windows 7/64 bit drivers


#12

maybe its just because its handled as one 5.1 surround device


#13

Hmm…well obviously the device is presenting itself differently if juce is seeing it as one large group of channels. But either way, juce needs to be improved to recognize the Fireface channels as one device, since it works in other programs.