[wdmaudiodev] Help please: How to set default audio format for USB headphone in via inf

  • From: Culann mac Cabe <culann@xxxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Tue, 22 Jan 2019 23:04:52 +0000

Hello wdnaudiodev people.

I am writing an APO for a USB headset device.  The headset hardware
supports 2 audio formats:  (48k Stereo 24bits) and (96k Stereo 24bits).

I would like the hardware, on installation, to default to the [48k Stereo
24bits] format and I believe I can do this in the .inf file as follows:

[OEMSettingsOverride.AddReg]
HKR,"EP\\0", %PKEY_AudioEndpoint_Association%,,%KSNODETYPE_HEADPHONES%
HKR,"EP\\0", %PKEY_AudioEngine_OEMFormat%, %REG_BINARY%, XXXX...X

- where "XXXX...X" is generated using code provided at
https://docs.microsoft.com/en-us/windows-hardware/drivers/audio/pkey-audioengine-oemformat


This handy code allows one to define this format using WAVEFORMATEXTENSIBLE
values, which I think is where I may be going wrong.

For my desired 2 channel, 48k, 24 bit format I have:

wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; wfx.Format.nChannels = 2;
wfx.Format.nSamplesPerSec = 48000; wfx.Format.nAvgBytesPerSec = 6 * 48000;
// blockalign * sample rate wfx.Format.nBlockAlign = 6; // 2 channels * 24
bits wfx.Format.wBitsPerSample = 24; wfx.Format.cbSize =
sizeof(WAVEFORMATEXTENSIBLE)
- sizeof(WAVEFORMATEX); wfx.Samples.wValidBitsPerSample = 24; // ???!!! In
APO Format negotiation this appears to be 32... wfx.dwChannelMask = 3;
wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;

Does the above look correct?

Thanks for your help as ever!
Culann

Other related posts: