[wdmaudiodev] 5.1 and 7.1 settings don't work in MSVAD "simple" example

  • From: "Paul Titchener" <pt@xxxxxxxxxxx>
  • To: <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Sat, 7 Jul 2012 16:18:48 -0700

As I mentioned in my last post, I’m working on creating a driver derived from 
the MSVAD “simple” example.

This example in unaltered form appears to be  partially set up to allow 6 
channel/5.1 and 8 channel/7.1 usage.

But if you hit “Configure” on the Sound panel and try to select and save the 
5.1 or 7.1 settings, you get a dialog stating:

    Error!: Format not supported by the device.

Taking a look at the code for the driver I can only find 2 locations that 
appear to control these channel settings.

minwave.cpp contains the lines:

if ((pKsFormat->DataFormat.MajorFormat == KSDATAFORMAT_TYPE_AUDIO) &&
    (pKsFormat->DataFormat.SubFormat == KSDATAFORMAT_SUBTYPE_PCM) &&
    (pKsFormat->DataFormat.Specifier == KSDATAFORMAT_SPECIFIER_WAVEFORMATEX))
{
    WAVEFORMATEX* pWfx = (WAVEFORMATEX*)&pKsFormat->WaveFormatEx;

    // make sure the WAVEFORMATEX part of the format makes sense
    if ((pWfx->wBitsPerSample == 16) &&
        ((pWfx->nSamplesPerSec == 44100) || (pWfx->nSamplesPerSec == 48000)) &&
        (pWfx->nBlockAlign == (pWfx->nChannels * 2)) &&
        (pWfx->nAvgBytesPerSec == (pWfx->nSamplesPerSec * pWfx->nBlockAlign)))
    {
        if ((pWfx->wFormatTag == WAVE_FORMAT_PCM) && (pWfx->cbSize == 0))
        {
            if (pWfx->nChannels == 2)
            {
                ntStatus = STATUS_SUCCESS;
            }
        }
        else 
        if ((pWfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE) && (pWfx->cbSize == 
CB_EXTENSIBLE))
        {
            WAVEFORMATEXTENSIBLE* pWfxT = (WAVEFORMATEXTENSIBLE*)pWfx;

            if (((pWfx->nChannels == 2) && (pWfxT->dwChannelMask == 
KSAUDIO_SPEAKER_STEREO)) ||
                ((pWfx->nChannels == 6) && (pWfxT->dwChannelMask == 
KSAUDIO_SPEAKER_5POINT1_SURROUND)) ||
                ((pWfx->nChannels == 8) && (pWfxT->dwChannelMask == 
KSAUDIO_SPEAKER_7POINT1_SURROUND)))
            {
                ntStatus = STATUS_SUCCESS;
            }
        }
    }
}

These lines appear to provide 5.1 and 7.1 support, which I’m assuming is why 
the options are available in the Sound Panel.

But the file simple.h contains:

// PCM Info
#define MIN_CHANNELS                      1       // Min Channels.
#define MAX_CHANNELS_PCM            2       // Max Channels.

This would appear to limit the driver to 2 channels, so I thought changing this 
to 8 and rebuilding and re-installing the driver would allow the selection of 
the 5.1 and 7.1 modes.

But even after rebuilding and re-installing, you still get the “format error” 
when you try to select the 5.1 or 7.1 modes.

Is there something else that needs to be changed or some additional lines that 
need to be added to the .inf file to allow 5.1 and 7.1 modes to work in this 
example?

Thanks,

Paul



Other related posts: