[wdmaudiodev] Re: Exposing more than 8 channels on Windows 7

  • From: Neetu Sand <neetu.freelist@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Mon, 9 Jan 2012 19:33:35 +0530

Hi Matthew,

Yes, I am seeing Get request. I am returning the default format expected by
my driver. Code is as follows:

        if (PropertyRequest->ValueSize == 0)
        {
            PropertyRequest->ValueSize = sizeof(KSDATAFORMAT_WAVEFORMATEX);
            return STATUS_BUFFER_OVERFLOW;
        }
        else if (PropertyRequest->ValueSize <
sizeof(KSDATAFORMAT_WAVEFORMATEX))
        {
            return STATUS_BUFFER_TOO_SMALL;
        }

        PKSDATAFORMAT_WAVEFORMATEX pKsFormat =
(PKSDATAFORMAT_WAVEFORMATEX)PropertyRequest->Value;
        PWAVEFORMATEX               pWaveFormatEx;

        pKsFormat->DataFormat.FormatSize   = sizeof
(KSDATAFORMAT_WAVEFORMATEX);
        pKsFormat->DataFormat.Flags        = 0;
        pKsFormat->DataFormat.Reserved     = 0;

        pKsFormat->DataFormat.MajorFormat  = KSDATAFORMAT_TYPE_AUDIO;
        pKsFormat->DataFormat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
        pKsFormat->DataFormat.Specifier =
KSDATAFORMAT_SPECIFIER_WAVEFORMATEX;
        pWaveFormatEx =
(PWAVEFORMATEX)((PKSDATAFORMAT)PropertyRequest->Value + 1);
        pWaveFormatEx->wFormatTag      = WAVE_FORMAT_EXTENSIBLE;
        pWaveFormatEx->nChannels       = MAX_CHANNELS; //16

        pWaveFormatEx->nSamplesPerSec  = m_SampleRate; //could be in range
of 32kHz-192 kHz
        pWaveFormatEx->wBitsPerSample  = 16;
        pWaveFormatEx->cbSize          = 0;
        pWaveFormatEx->nBlockAlign     =
            pWaveFormatEx->nChannels * pWaveFormatEx->wBitsPerSample / 8;
        pWaveFormatEx->nAvgBytesPerSec =
            pWaveFormatEx->nSamplesPerSec * pWaveFormatEx->nBlockAlign;

        pKsFormat->DataFormat.SampleSize   = pWaveFormatEx->nBlockAlign; //
must match nBlockAlign

        PropertyRequest->ValueSize = sizeof(KSDATAFORMAT_WAVEFORMATEX);
        ntStatus = STATUS_SUCCESS;
        return ntStatus;

I receive get call twice. First time it gets the size of buffer and second
time it extracts the format. Then I get a set call but the set call is
never made with 16 channels which is returned in Get call. I return
STATUS_SUCCESS in set call for (channel <=16). Set is called with channel
count 2 and then called with channel count that is selected as speaker
configuration i.e. if I keep speaker configuration 7.1 then second set call
is made with channel count 8.

So I don't know how can I show format for 16 channels on advance tab of my
speaker device. Because the speaker configuration only shows up to 7.1 that
is 8 channels. Do I need to disable configure button for speaker? If yes
then how can I do that?

Please note that I do the same things for my recording device and it shows
format for channel 1-16 i.e. it works as expected on sample rates 32kHz -48
kHz. For higher sample rates, this does not work and Advance tab is not
shown.

cheers,
Neetu




O n Fri, Jan 6, 2012 at 9:42 PM, Matthew van Eerde <
Matthew.van.Eerde@xxxxxxxxxxxxx> wrote:

>  Are you seeing a KSPROPERTY_TYPE_GET request?  What are you returning?***
> *
>
> ** **
>
> *From:* wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:
> wdmaudiodev-bounce@xxxxxxxxxxxxx] *On Behalf Of *Neetu Sand
> *Sent:* Friday, January 06, 2012 5:57 AM
> *To:* wdmaudiodev@xxxxxxxxxxxxx
> *Subject:* [wdmaudiodev] Exposing more than 8 channels on Windows 7****
>
> ** **
>
> Hi All,
>
> I have a query regarding publishing 16 channels on a speaker device. I
> specify channel count as 16 while specifying the datarange in pin factory.
> In handler for KSPROPERTY_PIN_PROPOSEDATAFORMAT, I handle condition for 16
> channels but the problem is that the handler for
> KSPROPERTY_PIN_PROPOSEDATAFORMAT is never called with 16 channels. It is
> called within the channel count range of 1-8. DataRangeIntersection is
> never called.
>
> Also I notice that for some devices "Advance" tab on Sound and Audio
> control panel shows "Channel, Bit Depth and Sample Rate" while for others,
> it just shows "Bit Depth and Sample rate". However for later case speaker
> configuration is enabled but for the earlier case "configure" button on
> Sound And audio control panel is disabled. What change in driver code leads
> to this behavior of Sound and Audio Control Panel? I tried removing
> KSPROPERTY_AUDIO_CHANNEL_CONFIG from my code but I still see "Configure"
> button enabled for my device.
>
> I am not sure what change in driver would let Sound and Audio CPL detect
> 16 channels for my device. Any help is appreciated.
>
> Cheers,
> Neetu****
>

Other related posts: