I think there may be an issue with the WASAPI channel count for multichannel devices. If I use the AudioDeviceManager to find WASAPI devices:
Then the devices are found correctly, but every device has only one channel available; i.e., getOutputChannelNames returns an array with one entry.
I think it has to do with numActualChannels being set to the same number of channels passed to the Initialize call:
[code] GUID session;
if (hr == S_OK
&& check (client->Initialize (useExclusiveMode ? AUDCLNT_SHAREMODE_EXCLUSIVE : AUDCLNT_SHAREMODE_SHARED,
0x40000 /AUDCLNT_STREAMFLAGS_EVENTCALLBACK/,
defaultPeriod, defaultPeriod, (WAVEFORMATEX*) &format, &session)))
{
actualNumChannels = format.Format.nChannels;
const bool isFloat = format.Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE && format.SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
bytesPerSample = format.Format.wBitsPerSample / 8;
updateFormat (isFloat);
return true;
}[/code]
The audio device manager is only asking for one channel, so actualNumChannels ends up set to one.
I was able to work around this by removing the line where actualNumChannels is changed and then judiciously changing actualNumChannels to numChannels in a few spots. It seems to work okay, except if an odd number of channels are selected.
Otherwise, I don’t see any way to discover the actual number of channels for the device; this is significant, since I’m looking for surround sound capable devices.
Cheers,
Matt