[wdmaudiodev] Re: Multichannel audio USB support

  • From: "Matthew van Eerde" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "Matthew.van.Eerde" for DMARC)
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Fri, 16 Dec 2016 17:04:33 +0000

If you’re looking for a way to present information to the user in the Sound 
control panel, you can write your own property page UI. Check out the SysVad 
driver’s proppageext.dll.
https://github.com/Microsoft/Windows-driver-samples/tree/master/audio/sysvad/SwapAPO/PropPageExtensions

I suppose the virtual speaker layout would depend on the content being played – 
e.g., if the user played a 5.1 movie, and then a 7.1 movie, you would downmix 
them differently, without the user having to go and touch anything in between?

From: Edward Abramian<mailto:edwabr123@xxxxxxxxx>
Sent: Friday, December 16, 2016 8:57 AM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: Multichannel audio USB support

Having speaker configuration wizard is indeed not a must, but it would be nice 
to somehow inform user about virtual speaker 5.1/7.1 layout. What I am after is 
having driver package WHQL signed, and I got another request which is 
supporting analog headsets along with USB.

From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Matthew van Eerde ;
(Redacted sender "Matthew.van.Eerde" for DMARC)
Sent: Friday, December 16, 2016 8:49 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: Multichannel audio USB support

I’m still confused why you need the speaker configuration wizard at all. Do you 
want to support multiple kinds of virtual surround?

From: Edward Abramian<mailto:edwabr123@xxxxxxxxx>
Sent: Friday, December 16, 2016 8:35 AM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: Multichannel audio USB support

I took time to look at the alternative, which is virtual audio device driver. 
It looks promising, but I need to clarify whether I will be able to have it 
WHQL signed. I will name it appropriately, e.g. (Virtual) Surround Headphones, 
and I don’t care about DRM protected content. But application can start stream 
in exclusive mode. And it looks like I will not be able to capture audio with 
WASAPI loopback in that case to redirect to a physical device. I could disable 
exclusive mode by failing with AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED, but I am 
afraid some applications will just reject my audio device, in particular games. 
Can I grant (or fake) exclusive mode to an application and still have WASAPI 
callback function? Or, if I implement my own user mode callback with audio 
buffer, will I be able to WHQL sign my driver?

Tzung-Dar Tsai,

Yes, it is reported as Headphones, and it’s a bummer I can’t change this from 
inf, and that’s why I am looking forward to implementing virtual audio device 
instead.

Thank you,
Edward

From: wdmaudiodev-bounce@xxxxxxxxxxxxx<mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Tsai Tzung-Dar ;(Redacted 
sender "tdtsai1973" for DMARC)
Sent: Monday, December 12, 2016 6:22 PM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: Multichannel audio USB support

Hi
Can you provide you USB Audio Device's Configuration descriptor? I guest your 
USB Audio Device report output terminal type is Headphone. Basically you can 
not change Endpoint type by INF.

BR,
Tzung-Dar Tsai

寄件者: Edward Abramian <edwabr123@xxxxxxxxx<mailto:edwabr123@xxxxxxxxx>>
收件者: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
寄件日期: 2016/12/13 (週二) 8:24 AM
主旨: [wdmaudiodev] Re: Multichannel audio USB support

I am setting it as KSNODETYPE_SPEAKER, but it doesn’t seem to have any effect. 
It still shows up as headphones. Installed same inf for USB speaker, and it 
keeps its Configure button enabled.

Here below is my inf file for reference. Note that I don’t copy and register my 
APO with inf, I have a separate installer for that.

[Version]
Signature="$Windows NT$"
Class=MEDIA
ClassGUID={4d36e96c-e325-11ce-bfc1-08002be10318}
provider=%ProviderName%
DriverVer=11/11/2001,15.25.44.897
CatalogFile=delta.cat

[Manufacturer]
%MfgName%=MfgModelSection,NT$ARCH$

[MfgModelSection.NT$ARCH$]
%USB\VID_0B0E&PID_A345&MI_00.DeviceDesc%=MYUSBAudio.SysFx,USB\VID_0B0E&PID_A345&MI_00
%USB\VID_0C76&PID_1529&MI_00.DeviceDesc%=MYUSBAudio.SysFx,USB\VID_0C76&PID_1529&MI_00
%USB\VID_0D8C&PID_0012&MI_00.DeviceDesc%=MYUSBAudio.SysFx,USB\VID_0D8C&PID_0012&MI_00
%USB\VID_046D&PID_0A37&MI_00.DeviceDesc%=MYUSBAudio.SysFx,USB\VID_046D&PID_0A37&MI_00

[MYUSBAudio.SysFx]
Include  =ks.inf,wdmaudio.inf,wdma_usb.inf
Needs    
=KS.Registration,WDMAUDIO.Registration,USBAudioOEM.CopyFiles,USBAudioOEM.AddReg

[MYUSBAudio.SysFx.Interfaces]
AddInterface=%KSCATEGORY_AUDIO%,"GLOBAL",MYUSBAudio.SysFx.PrimaryHeadphonesWave
AddInterface=%KSCATEGORY_RENDER%,"GLOBAL",MYUSBAudio.SysFx.PrimaryHeadphonesWave
AddInterface=%KSCATEGORY_AUDIO%,"GLOBAL",MYUSBAudio.SysFx.PrimaryHeadphonesTopo
AddInterface=%KSCATEGORY_TOPOLOGY%,"GLOBAL",MYUSBAudio.SysFx.PrimaryHeadphonesTopo

[MYUSBAudio.SysFx.PrimaryHeadphonesWave]
AddReg=MYUSBAudio.SysFx.PrimaryHeadphonesWave.AddReg

[MYUSBAudio.SysFx.PrimaryHeadphonesWave.AddReg]
HKR,,FriendlyName,,%PrimarySpeakersWaveDeviceName%
HKR,,CLSID,,%Proxy.CLSID%

[MYUSBAudio.SysFx.PrimaryHeadphonesTopo]
AddReg=MYUSBAudio.PrimaryHeadphonesTopo.AddReg,SysFx.AddReg

[MYUSBAudio.PrimaryHeadphonesTopo.AddReg]
HKR,,FriendlyName,,%PrimarySpeakersTopoDeviceName%
HKR,,CLSID,,%Proxy.CLSID%
HKR,"EP\\0",%PKEY_AudioEndpoint_Association%,,%KSNODETYPE_SPEAKER%

[MYUSBAudio.SysFx.Services]
Include=wdma_usb.inf
Needs=USBAudio.NT.Services

[SysFx.AddReg]
HKR,"FX\\0",%PKEY_ItemNameDisplay%,,%SYSFX_FriendlyName%
HKR,"FX\\0",%PKEY_FX_StreamEffectClsid%,,%SYSFX_SFX_CLSID%
HKR,"FX\\0",%PKEY_FX_EndpointEffectClsid%,,%SYSFX_EFX_CLSID%
HKR,"FX\\0",%PKEY_SFX_ProcessingModes_Supported_For_Streaming%,0x00010000,%AUDIO_SIGNALPROCESSINGMODE_DEFAULT%
HKR,"FX\\0",%PKEY_EFX_ProcessingModes_Supported_For_Streaming%,0x00010000,%AUDIO_SIGNALPROCESSINGMODE_DEFAULT%
HKR,"FX\\0",%PKEY_SYSFX_Association%,,%KSNODETYPE_SPEAKER%

[Strings]
; see audioenginebaseapo.idl for APO_FLAG enum values
SFX_APO_FLAG_DEFAULT = 0x0000000D
MFX_APO_FLAG_DEFAULT = 0x0000000F
EFX_APO_FLAG_DEFAULT = 0x0000000F

ProviderName   ="Company, Corp."
MfgName        ="Company, Corp."
SRCopyRight    ="Copyright (c) Company, Corp."
DiskDescription="Installation Media"

USB\VID_0B0E&PID_A345&MI_00.DeviceDesc="HP USB Audio Device #1 (Company)"
USB\VID_0C76&PID_1529&MI_00.DeviceDesc="HP USB Audio Device #2 (Company)"
USB\VID_0D8C&PID_0012&MI_00.DeviceDesc="HP USB Audio Device #3 (Company)"
USB\VID_046D&PID_0A37&MI_00.DeviceDesc="HP USB Audio Device #4 (Company)"

MediaCategories="SYSTEM\CurrentControlSet\Control\MediaCategories"

KSNAME_WaveHeadphones    ="WaveHeadphones"
KSNAME_TopologyHeadphones="TopologyHeadphones"

PrimarySpeakersWaveDeviceName ="Company Speakers"
PrimarySpeakersTopoDeviceName ="Company Speakers Topo"

PKEY_SYSFX_Association="{D04E05A6-594B-4FB6-A80D-01AF5EED7D1D},0"

PKEY_FX_StreamEffectClsid  ="{D04E05A6-594B-4fb6-A80D-01AF5EED7D1D},5"
PKEY_FX_ModeEffectClsid    ="{D04E05A6-594B-4fb6-A80D-01AF5EED7D1D},6"
PKEY_FX_EndpointEffectClsid="{D04E05A6-594B-4fb6-A80D-01AF5EED7D1D},7"

PKEY_ItemNameDisplay="{B725F130-47EF-101A-A5F1-02608C9EEBAC},10"

SYSFX_FriendlyName="Company Audio Enhancement"

SYSFX_SFX_CLSID="{50B77CE4-514E-4437-ACC8-2E3402C0787F}"
SYSFX_MFX_CLSID="{808135F6-334E-4C33-8F35-042CFC3A1B5C}"
SYSFX_EFX_CLSID="{E5F3D16C-9D98-4ECF-97D0-3FDAEAFC1073}"

SYSFX_TypeLib_CLSID="{854E2844-3053-4C07-80F8-119B4DB14BC6}"

SYSFX_SFX_FriendlyName="APOLFXSFX"
SYSFX_MFX_FriendlyName="APOGFXMFX"
SYSFX_EFX_FriendlyName="APOEFX"

SYSFX_SFX_CLASS_FriendlyName="APOSFX Class"
SYSFX_MFX_CLASS_FriendlyName="APOMFX Class"
SYSFX_EFX_CLASS_FriendlyName="APOEFX Class"

KSCATEGORY_AUDIO     ="{6994AD04-93EF-11D0-A3CC-00A0C9223196}"
KSCATEGORY_RENDER    ="{65E8773E-8F56-11D0-A3B9-00A0C9223196}"
KSCATEGORY_CAPTURE   ="{65E8773D-8F56-11D0-A3B9-00A0C9223196}"
KSCATEGORY_REALTIME  ="{EB115FFC-10C8-4964-831D-6DCB02E6F23F}"
KSCATEGORY_TOPOLOGY  ="{DDA54A40-1E4C-11D1-A050-405705C10000}"
KSNODETYPE_ANY       ="{00000000-0000-0000-0000-000000000000}"
KSNODETYPE_SPEAKER   ="{DFF21CE1-F70F-11D0-B917-00A0C9223196}"
KSNODETYPE_HEADPHONES="{DFF21CE2-F70F-11D0-B917-00A0C9223196}"
COMMUNICATION_SPEAKER="{DFF21CE6-F70F-11D0-B917-00A0C9223196}"

Proxy.CLSID="{17CCA71B-ECD7-11D0-B908-00A0C9223196}"

PKEY_SFX_ProcessingModes_Supported_For_Streaming="{D3993A3F-99C2-4402-B5EC-A92A0367664B},5"
PKEY_MFX_ProcessingModes_Supported_For_Streaming="{D3993A3F-99C2-4402-B5EC-A92A0367664B},6"
PKEY_EFX_ProcessingModes_Supported_For_Streaming="{D3993A3F-99C2-4402-B5EC-A92A0367664B},7"

AUDIO_SIGNALPROCESSINGMODE_DEFAULT="{C18E2F7E-933D-4965-B7D1-1EEF228D2AF3}"
AUDIO_SIGNALPROCESSINGMODE_MOVIE="{B26FEB0D-EC94-477C-9494-D1AB8E753F6E}"
AUDIO_SIGNALPROCESSINGMODE_COMMUNICATIONS = 
"{98951333-B9CD-48B1-A0A3-FF40682D73F7}"

PKEY_AudioEndpoint_Association="{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},2"

From: wdmaudiodev-bounce@xxxxxxxxxxxxx<mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Matthew van Eerde ;
(Redacted sender "Matthew.van.Eerde" for DMARC)
Sent: Monday, December 12, 2016 3:43 PM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: Multichannel audio USB support

What is the terminal type in KSPIN_DESCRIPTOR.Category?

From: Edward Abramian<mailto:edwabr123@xxxxxxxxx>
Sent: Monday, December 12, 2016 3:22 PM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: Multichannel audio USB support

Bumping this thread in case anyone knows how to enable “Configure” button for 
accessing Speaker Setup control panel. In my driver based on wdma_usb.inf it’s 
grayed out. Any hint will be appreciated.

From: Edward Abramian [mailto:edwabr123@xxxxxxxxx]
Sent: Friday, December 2, 2016 4:37 PM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: RE: [wdmaudiodev] Re: Multichannel audio USB support

Removing APO_FLAG_SAMPLESPERFRAME_MUST_MATCH helped. Now I receive 6 channels 
in IsInputFormatSupported. Thanks for helping with this.

I noticed that “Configure” button for my USB device is grayed out. So, I can’t 
select preferable speaker configuration (Stereo, Quad, 5.1 etc) in Speaker 
Setup control panel. I guess there should be something I need declare in my 
.inf to make supported speaker configurations available for user to choose from?

Thank you again for your great help!

From: wdmaudiodev-bounce@xxxxxxxxxxxxx<mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Matthew van Eerde ;
(Redacted sender "Matthew.van.Eerde" for DMARC)
Sent: Friday, December 2, 2016 3:43 PM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: Multichannel audio USB support

Try using TopoEdit.exe 
https://msdn.microsoft.com/en-us/library/windows/desktop/ff485862(v=vs.85).aspx

Set a breakpoint on your IAudioProcessingObject::IsInputFormatSupported 
implementation

If you’re using CBaseAudioProcessingObject, you will need to modify your flags. 
The default flags have APO_FLAG_SAMPLESPERFRAME_MUST_MATCH. This will reject 
any attempt to pair an input format and an output format with a different 
number of channels.

// audioenginebaseapo.h

enum APO_FLAG
    {
        APO_FLAG_NONE   = 0,
        APO_FLAG_INPLACE              = 0x1,
        APO_FLAG_SAMPLESPERFRAME_MUST_MATCH      = 0x2,
        APO_FLAG_FRAMESPERSECOND_MUST_MATCH      = 0x4,
        APO_FLAG_BITSPERSAMPLE_MUST_MATCH              = 0x8,
        APO_FLAG_MIXER = 0x10,
        APO_FLAG_DEFAULT            = ( ( APO_FLAG_SAMPLESPERFRAME_MUST_MATCH | 
APO_FLAG_FRAMESPERSECOND_MUST_MATCH )  | APO_FLAG_BITSPERSAMPLE_MUST_MATCH )
    }          APO_FLAG;

From: Edward Abramian<mailto:edwabr123@xxxxxxxxx>
Sent: Friday, December 2, 2016 3:36 PM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: Multichannel audio USB support

I keep receiving stereo in my SFX even if I play 5.1 audio file. Is there 
something I need to expose in my .inf file to tell Windows that my USB device 
supports multichannel input?

From: Edward Abramian [mailto:edwabr123@xxxxxxxxx]
Sent: Friday, December 2, 2016 2:38 PM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: RE: [wdmaudiodev] Re: Multichannel audio USB support

Will do. Thanks!

From: wdmaudiodev-bounce@xxxxxxxxxxxxx<mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Matthew van Eerde ;
(Redacted sender "Matthew.van.Eerde" for DMARC)
Sent: Friday, December 2, 2016 2:04 PM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: Multichannel audio USB support

Also, make sure to implement 
IAudioSystemEffects2::GetEffectsList<https://msdn.microsoft.com/en-us/library/windows/desktop/dn280325(v=vs.85).aspx>
 and report AUDIO_EFFECT_TYPE_VIRTUAL_SURROUND, 
AUDIO_EFFECT_TYPE_VIRTUAL_HEADPHONES, and/or other effects types as appropriate 
so that apps are aware of the processing you’re doing.

From: Edward Abramian<mailto:edwabr123@xxxxxxxxx>
Sent: Friday, December 2, 2016 1:39 PM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: Multichannel audio USB support

Thank you for clarifying this for me. I will try you recommendations.

Have a great weekend!
Edward

From: wdmaudiodev-bounce@xxxxxxxxxxxxx<mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Matthew van Eerde ;
(Redacted sender "Matthew.van.Eerde" for DMARC)
Sent: Friday, December 2, 2016 1:33 PM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: Multichannel audio USB support

I see, you want to provide custom downmixing.

You can do this by implementing an SFX APO that supports both stereo and 
multichannel input, and always outputs stereo. Your driver package will have an 
.inf and a .dll in it; no need for a custom .sys.

Media players will call IAudioClient::IsFormatSupported(…) with the source 
content. If the source is multichannel, this will succeed, and your custom 
downmixing will be in effect.

(To be complete, I will mention that whether IAudioClient::IsFormatSupported is 
called depends on the particular API the app is using to stream. Some legacy 
APIs will open in the mix format regardless of the source content. For those 
apps, your SFX will be opened in stereo mode.)

From: Edward Abramian<mailto:edwabr123@xxxxxxxxx>
Sent: Friday, December 2, 2016 1:27 PM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: Multichannel audio USB support

The resulting audio device will support multichannel input through downmixing 
it into stereo in SFX. The downmixing is done the way it preserves sound 
localization by use of binaural/HRTF techniques. So apps are free to choose 
multichannel output on that device.

From: wdmaudiodev-bounce@xxxxxxxxxxxxx<mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Tim Roberts
Sent: Friday, December 2, 2016 1:22 PM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: Multichannel audio USB support

Edward Abramian wrote:

To be clear on what exactly I need, let me describe it from the user 
perspective. I want a USB audio device to show up as supporting multichannel 
input, such as 5.1 or 7.1, so that user can configure it from Speaker Setup 
control panel. Internally, per my understanding, this will mean downmixing 
multichannel input into stereo in SFX to match USB headset stereo output.

If the hardware does not support 5.1 or 7.1, why would you want to pretend that 
it does?  That's just going to produce a confusing user experience.  Apps will 
assume they can exploit the additional channels.

--

Tim Roberts, timr@xxxxxxxxx<mailto:timr@xxxxxxxxx>

Providenza & Boekelheide, Inc.







PNG image

Other related posts: