The Windows WASAPI does not provide a function to list all supported audio formats of an audio device. Instead, one has to provide a WAVEFORMATEX structure with the desired format parameters and use IsFormatSupported to check whether that particular format is supported. There is support for IEC61937 DST/DSD, but I can not figure out how to set the format parameters for e.g. DSD64, and it never provides a closest matching format either. What's wrong with these parameters?
WAVEFORMATEXTENSIBLE_IEC61937 format;
memset(&format, 0, sizeof(WAVEFORMATEXTENSIBLE_IEC61937));
format.FormatExt.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
format.FormatExt.Format.nChannels = 2;
format.FormatExt.Format.nSamplesPerSec = 44100 * 64;
format.FormatExt.Format.wBitsPerSample = 1;
format.FormatExt.Format.nBlockAlign = format.FormatExt.Format.nChannels * 64;
format.FormatExt.Format.nAvgBytesPerSec = format.FormatExt.Format.nChannels * format.FormatExt.Format.nSamplesPerSec / 8;
format.FormatExt.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE_IEC61937) - sizeof(WAVEFORMATEX);
format.FormatExt.Samples.wValidBitsPerSample = 1;
format.FormatExt.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
format.FormatExt.SubFormat = KSDATAFORMAT_SUBTYPE_IEC61937_DST;
format.dwEncodedSamplesPerSec = 0;
format.dwEncodedChannelCount = 2;
format.dwAverageBytesPerSec = 0;
I think
dwEncodedSamplesPerSecshould be44100.The IEC-61937 format doc says:
ksmedia.h, the header file, says the same thing, but adds that the byte rate "can be zero".