Answered by:
Setting default format using .inf file (USB Audio)

Question
-
I have a USB audio device and I am writing an inf file for it. Basically I have to do this instead of using the default Windows wdma_usb.inf for 2 reasons:
1. This device must NOT become the default playback device (my inf solved this problem by not setting SetupPreferredAudioDevices)
2. I need the default sound format to be set to 4 channel, 16 bit, 8000 Hz (instead of 4 channel, 16 bit, 24000 Hz)
I looked at the sysfx example from WinDDK but I am not yet used to create inf files. Currently it doesn't work but I am not usre why. There are 2 elements that I am not sure about them and it is not easy to debug that.
First, I am not sure about the value I have to set for PKEY_AudioEngine_OEMFormat. The value I set (trying to get 4 channels, 16 bit, 8000 Hz) is 41,00,8C,70,28,00,00,00,FE,FF,04,00,40,1F,00,00,00,FA,00,00,08,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 am not sure this is the right value. Looking at the registry when I change this value in the Vista Digital Audio Interface Properties GUI, I see a very similar string but with some differences so maybe that is why it doesn't work (but I tried that string and it still didn't work).
The other element I am confused about is how to prepare the use of that section:
[OEMSettingsOverride.AddReg]
HKR,"EP\\0", %PKEY_AudioEndpoint_Association%,,%KSNODETYPE_SPEAKER%
HKR,"EP\\0", %PKEY_AudioEngine_OEMFormat%, %REG_BINARY%,
41,00,8C,70,28,00,00,00,FE,FF,04,00,40,1F,00,00,00,FA,00,00,08,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,71HKR,"EP\\0", %PKEY_AudioEndpoint_Ext_UiClsid%,,%AUDIOENDPOINT_EXT_UI_CLSID%
The other important part of my inf (I can post more is this is needed) is:
;============================================================================
[USBAudio]
Include=ks.inf,wdmaudio.inf
Needs=KS.Registration,WDMAUDIO.Registration,mssysfx.CopyFilesAndRegister
CopyFiles=USBAudio.CopyList
AddReg=USBAudio.AddReg;============================================================================
[USBAudio.Interfaces]
AddInterface=%KSCATEGORY_AUDIO%,"GLOBAL",USBAudio.Interface.Curve,
AddInterface=%KSCATEGORY_RENDER%,"GLOBAL",USBAudio.Interface.Curve,
AddInterface=%KSCATEGORY_CAPTURE%,"GLOBAL",USBAudio.Interface.Curve,
;============================================================================[USBAudio.Interface.Curve]
AddReg=USBAudio.Interface.Addreg.Curve, USBAudio.SysFx.Render[USBAudio.Interface.AddReg.Curve]
HKR,,FriendlyName,,%USB\VID_15C9&PID_0106&MI_01.DeviceDesc%
HKR,,CurveType,1,01,00,00,00
HKR,,CLSID,,%Proxy.CLSID%;============================================================================
[USBAudio.AddReg]
HKR,,AssociatedFilters,,"wdmaud,redbook"
HKR,,Driver,,USBAUDIO.sys
HKR,,NTMPDriver,,"USBAUDIO.sys,sbemul.sys"HKR,,CLSID,,%Proxy.CLSID%
HKR,Drivers,SubClasses,,"wave,midi,mixer,aux"
HKR,Drivers\wave\wdmaud.drv, Driver,,wdmaud.drv
HKR,Drivers\midi\wdmaud.drv, Driver,,wdmaud.drv
HKR,Drivers\mixer\wdmaud.drv,Driver,,wdmaud.drv
HKR,Drivers\aux\wdmaud.drv,Driver,,wdmaud.drvHKR,Drivers\wave\wdmaud.drv,Description,,%USBGenericDesc%
HKR,Drivers\midi\wdmaud.drv,Description,,%WDM_MIDI%
HKR,Drivers\mixer\wdmaud.drv,Description,,%USBGenericDesc%
HKR,Drivers\aux\wdmaud.drv,Description,,%USBGenericDesc%HKLM,%MediaCategories%\%USBGUID.BassBoost%,Name,,%USBNode.BassBoost%
HKLM,%MediaCategories%\%USBGUID.BassBoost%,Display,1,00,00,00,00
HKLM,%MediaCategories%\%USBGUID.StereoExtend%,Name,,%USBNode.StereoExtend%
HKLM,%MediaCategories%\%USBGUID.StereoExtend%,Display,1,00,00,00,00I tried to add AddInterface=%KSCATEGORY_TOPOLOGY%,"GLOBAL",USBAudio.PrimaryLineOutTopo in [USBAudio.Interfaces] and then in that section (USBAudio.PrimaryLineOutTopo ) I added the OEMSettingsOverride.AddReg but it didn't work. I am pretty sure that is not the right way to do it, I will continue to read about the subject but I would appreciate any help I could get about this.
Thanks
Thursday, April 10, 2008 3:03 PM
Answers
-
Actually it seems that wReserved2 is the byte size of the BLOB data, so that should be left as is. I don't know what wReserved1 is, so perhaps it's best left alone?
But the channel mask definitely needs to be fixed. See the SPEAKER_FRONT_LEFT et al. definitions in ksmedia.h. You may want 0x0033 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) or you may want 0x0107 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER) depending on what kind of surround you're doing.
Or you might try leaving the channel mask 0.Friday, April 25, 2008 5:08 PM
All replies
-
What string is in the registry when you manually set the default format via the GUI?Thursday, April 10, 2008 11:41 PM
-
There are 2 strings in the registry for my device that looks similar. In HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Render\_STRING_\Properties, here are the 2 keys and values.
{f19f064d-082c-4e27-bc73-6882a1bb8e4c},0: 41,00,4f,74,28,00,00,00,fe,ff,04,00,40,1f,00,00,00,fa,00,00,08,00,10,00,16,00,10,00,00,00,00,00,01,00,00,00,00,00,10,00,80,00,00,aa,00,38,9b,71
{e4870e26-3cc5-4cd2-ba46-ca0a9a70ed04},0: 41,00,4f,74,28,00,00,00,fe,ff,04,00,40,1f,00,00,00,f4,01,00,10,00,20,00,16,00,20,00,00,00,00,00,03,00,00,00,00,00,10,00,80,00,00,aa,00,38,9b,71
Thanks for your help.
Friday, April 11, 2008 6:00 PM -
Any idea if my problem is with the value of the PKEY_AudioEngine_OEMFormat that I use or if it is the way I call it using the KSCATEGORY_TOPOLOGY?
Thanks
Wednesday, April 16, 2008 2:06 PM -
Matthew, did I give you the right info? I am really lost right now as to why this doesn't work. I tried many modifications to my inf and none of them work. I don't really know how I can debug this. I do see some keys in the registry added but when I plug my device the wrong audio format is still chosen by default and those values in the registry seem to have no effect. :-(
Thanks
Thursday, April 17, 2008 7:40 PM -
Sorry for the delay in replying. Looking at your initial format, I think the channel mask needs to be updated to contain four channels. Here's the breakdown:
41,00,8C,70,28,00,00,00,FE,FF,04,00,40,1F,00,00,00,FA,00,00,08,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
This is a PropVariant of type VT_BLOB:
vt 0x0041 // VT_BLOB
wReserved1 0x708C - this should probably be 0
wReserved2 0x0028 - so should this
wReserved3 0x0000
Here's the blob data, which is interpreted as a WAVEFORMATEXTENSIBLE:
WAVEFORMATEXTENSIBLE
WAVEFORMATEX
wFormatTag 0xFFFE // WAVE_FORMAT_EXTENSIBLE
nChannels 0x0004
nSamplesPerSec 0x00001F40 // 8000
nAvgBytesPerSec 0x0000FA00 // 64000
nBlockAlign 0x0008
wBitsPerSample 0x0010 // 16 bits
cbSize 0x0016
Samples.wValidBitsPerSample 0x0010 // all bits valid
dwChannelMask 0x00000003 // stereo, but there are four channels!
SubFormat {00000001-0000-0010-8000-00aa00389b71} // PCMFriday, April 25, 2008 4:57 PM -
Actually it seems that wReserved2 is the byte size of the BLOB data, so that should be left as is. I don't know what wReserved1 is, so perhaps it's best left alone?
But the channel mask definitely needs to be fixed. See the SPEAKER_FRONT_LEFT et al. definitions in ksmedia.h. You may want 0x0033 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) or you may want 0x0107 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER) depending on what kind of surround you're doing.
Or you might try leaving the channel mask 0.Friday, April 25, 2008 5:08 PM -
Thanks a lot for your help Matthew, I really really appreciate it!!!
I managed to get a second USB audio device that we have here and that one supports 48kHz, 16-bit, Stereo (the format in the sysfx.inf example in the WDK). So I tried my inf file using that value (48kHz, 16-bit, Stereo) but the sound format was still set to 44kHz, 16-bit, Stereo. So my conclusion is that there is a problem with the way I set it with the KSCATEGORY_TOPOLOGY. So right now, what I am trying to do is simply set it to 48kHz, 16-bit, Stereo using the sysfx.inf example value.
Again, I really appreciate your help Matthew, I talked to many people about this problem but no one was helpful as you are. Thanks.
Monday, April 28, 2008 12:32 PM -
Hi Matthew
Thanks a lot for your help, I got it working.
Monday, May 5, 2008 12:15 PM -
JFC Dev, i got a problem, simalar to yours
i need some help with an .inf file
i got the standard TI PCM2902 but im only using as INPUT device
i dont want it to become default playback (1 nothing is connected to it, 2 annoyance)
and i need its format set to 16bit 2channel 44.1k
i trying taking appart, wdm_audio.inf and i got lost
could you share your .inf?
would really save me :)
thanks
mitchThursday, October 15, 2009 3:09 AM -
Hey JFC Dev, any chance you see this if I resurrect it? I was hoping you could share insight into how you were able to resolves your issue.
Thanks!
Saturday, October 26, 2019 8:55 AM