[wdmaudiodev] Re: How to set a driver's default sampling frequency and num channels

  • From: Basileios Bu <basileiosbu@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Thu, 5 Jul 2012 17:48:51 -0400

Hello,
Thank you for your reply.  My problem is this: I want our device out of the
box to work in quad instead of just stereo in supported WDM audio host
software.  I believe that my data ranges are correct because when I set the
speaker configuration myself in the Windows audio CPL works fine in quad,
but it would be very nice for it to work in quad right out of the box
without the user having to change the speaker configuration.  So I
implemented a KSPROPERTY_AUDIO_CHANNEL_CONFIG handler, and always returned
quad, thus:

((KSAUDIO_CHANNEL_CONFIG *)data)->ActiveSpeakerPositions =
KSAUDIO_SPEAKER_QUAD;
irp->IoStatus.Information = sizeof(KSAUDIO_CHANNEL_CONFIG);
irp->IoStatus.Status = STATUS_SUCCESS;
return STATUS_SUCCESS;

I see the system queries me on startup, but much to my chagrin, the speaker
configuration is still stereo.  This property is implemented in the DAC
node.
Since this failed, I tried to implement PKEY_AudioEngine_OEMFormat
or PKEY_AudioEngine_DeviceFormat in my INF:

[OEMSettingsOverride.AddReg]
HKR,"EP\\0", %PKEY_AudioEndpoint_Association%,,%KSNODETYPE_SPEAKER%
; Should set default to 44.1khz, 4 channel, 16 bits
HKR,"EP\\0", %PKEY_AudioEngine_OEMFormat%, %REG_BINARY%,
41,00,00,00,28,00,00,00,FE,FF,04,00,44,AC,00,00,10,B1,02,00,04,00,10,00,16,00,10,00,33,00,00,00,01,00,00,00,00,00,10,00,80,00,00,AA,00,38,9B,71

I see the registry entries in the registry, but I'm still in stereo

My KSDATARANGE must be correct, I believe, because when I set myself
manually to quad in the Windows audio CPL, it works fine.
My maximum channels is always 4, max/min bits per sample is 24 (as the
hardware only supports this, and Windows converts for me), and I have
entries for all supported sample rates and moreover for WAVEFORMATEX and
DSOUND.

So why does the default format stereo, 44.1, 16 bits is the question, and
how could I coerce the system to have it quad, 44.1, 16 bits?

Thanks for any help.

On Thu, Jul 5, 2012 at 5:33 PM, Tim Roberts <timr@xxxxxxxxx> wrote:

> Basileios Bu wrote:
> >
> > Thank you for your response.  This is my first avstream driver, so
> > while I've implemented this property for portcls, I've never done so
> > for avstream.  I'm obviously doing something wrong, because I never
> > see it being called.  This is my setup (perhaps the MinSize is wrong,
> > but I've tried also with just sizeof(KSDATAFORMAT)):
> > ...
> > I've verified with the debugger that I've put this in correctly in
> > my KSFILTER_DESCRIPTOR struct which I then pass
> > to KsCreateFilterFactory.  I've done this for both PCM render and
> > capture, with neither being called?  When would I see the handler
> > being called?
>
> I believe KS will handle this property on your behalf, based on the
> KSDATARANGEs in your pin.  Did you already show us your KSDATARANGE?
>
>
> > Also, I have some general questions for KS property handlers:
> > a) Is the only way to find the size of the output buffer from the IRP
> > (pIrp->Parameters.DeviceIoControl.OutputBufferLength)?
>
> Yes.
>
>
> > b) Should I always set the irp->Information field for cases of success
> > when I've filled the buffer, or also for cases when the buffer is NULL
> > (I would return STATUS_BUFFER_OVERFLOW) and/or the buffer size is too
> > small (STATUS_BUFFER_OVERFLOW)?
>
> KS will handle some of this for you.  It ensures that your output buffer
> is as large as the size you specified in your KSPROPERTY_TABLE structure.
>
> --
> Tim Roberts, timr@xxxxxxxxx
> Providenza & Boekelheide, Inc.
>
> ******************
>
> WDMAUDIODEV addresses:
> Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
> Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
> Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
> Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx
>
> URL to WDMAUDIODEV page:
> http://www.wdmaudiodev.com/
>
>

Other related posts: