JUCE Windows Audio implementation doesn't support multi-channel audio interfaces

When using WASAPI mode in JUCE - Windows audio or Windows Audio (Exclusive), only the first pair of inputs or outputs of an audio interface are exposed via device manager.
I have investigated the cause and the problem is that JUCE’s WASAPI implementation is making a faulty assumption that the max number of channels is the audioclient mix format.

In WASAPIDeviceBase.

    if (! getClientMixFormat (tempClient, format))
        return;

    actualNumChannels = numChannels = format.Format.nChannels;

In WASAPI the proper way to determine the actual number of supported channels is to iteratively test every supported format.

I can see that JUCE is doing some iterative testing in the findSupportedFormat method but it needs to go a lot further and additionally test every format including the channel count. There is no other way to do this (Yes, I have complained to Microsoft that there is no proper query API many years ago)

This is how I handle it in Cakewalk:
I start at 24 channels and work my way down testing for success until it succeeds. At that point you have the max channels supported. Its not ideal since its a bit slow but its the only definitive way to do it and it works. Once you have the max channels you can handle it similarly to how its done for ASIO.
Let me know if you have any questions, or PM me and I can share some code samples with you.

This should now be fixed on the develop branch with commit 9f803fe.

2 Likes

@fr810 Cool. Are you back?

2 Likes

@reFX I’ll be helping out for a few weeks while @t0m is taking parental leave. He’ll still be around but less responsive. Anyways, it’s good to be back!

7 Likes

Very awesome of PACE to hire you temporarily. :+1:

1 Like