[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 16:53:30 -0400

Hello,
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)):

// assign property set to automation table
mProposedDataFormatAutomationTable.PropertySetsCount = 1;
mProposedDataFormatAutomationTable.PropertyItemSize =
sizeof(KSPROPERTY_ITEM);
mProposedDataFormatAutomationTable.PropertySets =
mProposedDataFormatPropertySet;
mProposedDataFormatAutomationTable.EventSetsCount = 0;
mProposedDataFormatAutomationTable.EventItemSize = 0;
mProposedDataFormatAutomationTable.EventSets = NULL;
// assign property item to property set
mProposedDataFormatPropertySet[0].Set = &KSPROPSETID_Pin;
mProposedDataFormatPropertySet[0].PropertiesCount = 1;
mProposedDataFormatPropertySet[0].PropertyItem =
&mProposedDataFormatPropertyItem[0];
// init property item Volume
mProposedDataFormatPropertyItem[0].PropertyId =
KSPROPERTY_PIN_PROPOSEDATAFORMAT;
mProposedDataFormatPropertyItem[0].GetPropertyHandler =
GetProposedDataFormat_Static;
mProposedDataFormatPropertyItem[0].SetPropertyHandler = NULL;
mProposedDataFormatPropertyItem[0].MinProperty = sizeof(KSP_PIN);
mProposedDataFormatPropertyItem[0].MinData =
sizeof(KSDATAFORMAT)+sizeof(WAVEFORMATEXTENSIBLE);
mProposedDataFormatPropertyItem[0].Values = NULL;
mProposedDataFormatPropertyItem[0].SupportHandler = NULL;

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?

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)?
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)?

Thanks for any help.

On Thu, Jul 5, 2012 at 12:25 PM, Matthew van Eerde <
Matthew.van.Eerde@xxxxxxxxxxxxx> wrote:

>  Implement KSPROPERTY_PIN_PROPOSEDATAFORMAT / “Get” and Windows 7 will
> default to the format your driver prefers.****
>
> ** **
>
> *From:* wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:
> wdmaudiodev-bounce@xxxxxxxxxxxxx] *On Behalf Of *Basileios Bu
> *Sent:* Wednesday, July 4, 2012 3:07 PM
>
> *To:* wdmaudiodev@xxxxxxxxxxxxx
> *Subject:* [wdmaudiodev] Re: How to set a driver's default sampling
> frequency and num channels****
>
> ** **
>
> Hello,****
>
> ** **
>
> Sorry to jump in like this, but I have the same issue with my avstream
> driver.  I would like to have 4 channel 16 bit 44.1k by default, but so far
> I've had no luck.  During installation, I monitor my intersection handler
> with WPP traces, and the caller data range is always two channels.  I'm
> pretty sure that I serialized the WAVEFORMATEXTENSIBLE struct correctly,
> especially as I used the code from here to do it:****
>
>
> http://msdn.microsoft.com/en-us/library/windows/hardware/ff537752(v=vs.85).aspx
> ****
>
> Also, it's strange that the link below says that Windows 7 is required
> while the link above says that Windows Vista and higher is required (I
> tested on Windows 7 x64, debugger attached):****
>
>
> http://msdn.microsoft.com/en-us/library/windows/desktop/dd316584(v=vs.85).aspx
> ****
>
> In any case, I only add the registry values via the INF files (see below
> for the extract) to the topology.  I have also
> tried PKEY_AudioEngine_DeviceFormat, and that fails also.  Does anyone have
> any idea why?  Should I add the registry values anywhere else?  I've
> confirmed that they are added by browsing with regedit.****
>
> I've also tried adding a KSPROPERTY_AUDIO_CHANNEL_CONFIG handler, and
> always returning KSAUDIO_SPEAKER_QUAD for a get.  Not sure if this is
> required, though.****
>
> ** **
>
> Thank you for any help.****
>
> ** **
>
> (Also tried with PKEY_AudioEngine_DeviceFormat)****
>
> ** **
>
> [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
> ****
>
> ** **
>
> On Tue, Jul 3, 2012 at 11:08 PM, Jeff Pages <barefeet@xxxxxxxxxxxxxx>
> wrote:****
>
> Hi Paul,****
>
>  ****
>
> The OEMSettingsOverride.AddReg has to be included in the Topology
> Interface sections of the INF, i.e.****
>
>  ****
>
> [NEW_Device.NTX86.Interfaces]****
>
> ...****
>
>
> AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Topology1%,NEW_Device.Interface.Topology1
> ****
>
> ...****
>
> [NEW_Device.Interface.Topology1]****
>
> AddReg=NEW_Device.I.Topo1.AddReg, OEMSettingsOverride.AddReg****
>
>  ****
>
> [NEW_Device.I.Topo1.AddReg]****
>
> HKR,,CLSID,,%Proxy.CLSID%****
>
> HKR,,FriendlyName,,%NEW_Device.Topology1.szPname%****
>
>  ****
>
> Also, do you have KSNODETYPE_SPEAKER defined in the Strings section of
> your INF file? It should be:****
>
> KSNODETYPE_SPEAKER  = "{DFF21CE1-F70F-11D0-B917-00A0C9223196}"****
>
>  ****
>
> Jeff****
>
>  ****
>
>  ****
>
> *From:* wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:
> wdmaudiodev-bounce@xxxxxxxxxxxxx] *On Behalf Of *Paul Titchener
> *Sent:* Wednesday, 4 July 2012 12:09 PM
> *To:* wdmaudiodev@xxxxxxxxxxxxx
> *Subject:* [wdmaudiodev] Re: How to set a driver's default sampling
> frequency and num channels****
>
>  ****
>
> Hi Paul,****
>
>  ****
>
> For Vista and later platforms, you can use PKEY_AudioEngine_OEMFormat in
> the INF file to do this. This is documented in the WDK under Media-Class
> INF Extensions (
> http://msdn.microsoft.com/en-us/library/windows/hardware/ff537752(v=vs.85).aspx
> ).****
>
>  ****
>
> Jeff****
>
>  ****
>
> I’m not having any luck getting this to work.****
>
>  ****
>
> As described in the link above, I added the section below to the driver’s
> .inf file:****
>
>  ****
>
> [OEMSettingsOverride.AddReg]****
>
> HKR,"EP\\0", %PKEY_AudioEndpoint_Association%,,%KSNODETYPE_SPEAKER%****
>
> ; Should set default to 48khz, 2 channel, 16 bits****
>
> HKR,"EP\\0", %PKEY_AudioEngine_OEMFormat%, %REG_BINARY%,
> 41,00,00,00,28,00,00,00,FE,FF,02,00,80,BB,00,00,00,EE,02,00,04,00,10,00,16,00,10,00,03,00,00,00,01,00,00,00,00,00,10,00,80,00,00,AA,00,38,9B,71
> ****
>
>  ****
>
> I’m calling this added section as shown below:****
>
> [NEW_Device.NT]****
>
> Include=ks.inf,wdmaudio.inf****
>
> Needs=KS.Registration, WDMAUDIO.Registration****
>
> CopyFiles=NEW_Device.CopyList****
>
> AddReg=NEW_Device.AddReg, OEMSettingsOverride.AddReg****
>
>  ****
>
> [Strings]****
>
> PKEY_AudioEndpoint_Association          =
> "{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},2"****
>
> PKEY_AudioEngine_OEMFormat              =
> "{E4870E26-3CC5-4CD2-BA46-CA0A9A70ED04},3"****
>
>  ****
>
> After running the installation, on the Properties files for the driver
> regedit doesn’t show any lines with the E4870E26-3CC5-4CD2-BA46-CA0A9A70ED04
> format key.****
>
>  ****
>
> But if I use the Sound panel to manually change the sampling frequency,
> then as expected the lines with the E48 ... key value show up, holding the
> binary format info.****
>
>  ****
>
> Am I doing something wrong or is there some other trick to get this to
> work?****
>
> ** **
>

Other related posts: