WASAPI speaker mask

I’m noticing that with my Realtek 7.1 motherboard audio, I don’t seem to be able to send audio to the 7th and 8th channels in WASAPI shared mode.

I think this is due to the hardcoded speaker mask used in WASAPIDeviceBase::tryInitialisingWithFormat:

switch (numChannels) { // snip case 8: format.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_FRONT_LEFT_OF_CENTER | SPEAKER_FRONT_RIGHT_OF_CENTER; break; default: break; }
This sets dwChannelMask to 0xff. However, the Realtek is using a channel mask of 0x63f for its mix format. If I change the channel mask in tryInitialisingWithFormat to 0x63f, I can play out the upper channels just fine.

I suggest that the JUCE channel mask be set to match the mix format.

Matt

Ok… but down at line 582, it should use the suggested format if the one that’s being asked for fails… Isn’t that working?

The problem is that the call to IsFormatSupported succeeds even if the speaker mask is different. I added some debug output to the WASAPI code:

WASAPIDeviceBase constructor
GetMixFormat dwChannelMask:63f

tryInitialisingWithFormat
Calling IsFormatSupported with dwChannelMask:ff
IsFormatSupported returned hr:0
nearestFormat:0

So IsFormatSupported is perfectly happy with the mis-matched channel mask and doesn’t provide a suggested format. Using the channel mask from the mix format works.

Matt

Gotcha. Try it now…

That works fine. Thanks, Jules.

Matt