[wdmaudiodev] Re: APO custom formats

  • From: "Matthew van Eerde" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "Matthew.van.Eerde" for DMARC)
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Wed, 20 Nov 2019 20:55:03 +0000

Thanks for the traces.

Looks like csgo.exe is loading C:\Windows\SysWOW64\XAudio2_7.dll version 9.29 
(DXSDK_JUN10.100602-0421) which is about nine years old, and which, apparently, 
does not follow the recommended procedures for negotiating an IAudioClient 
format.

I believe more recent versions of XAudio2 call IAudioClient::IsFormatSupported 
and should therefore work with your SFX.

From: Andrey Zui<mailto:dmarc-noreply@xxxxxxxxxxxxx>
Sent: Wednesday, November 20, 2019 12:02 PM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: APO custom formats

Hello Matthew,

Thank you for the helpful link.

Here are the links to the traces:

  *   
csgo-surround.etl<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F1LDIANq9_AlC-PQyBThAaxjz8JTNswUaP%2Fview%3Fusp%3Dsharing&data=02%7C01%7CMatthew.van.Eerde%40microsoft.com%7C3317a66759144f001fd308d76df49202%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637098769513287140&sdata=YAis0GJ1GtXn5hj5qwOT2X%2Fi7nZJDifjo%2FHG%2FwXAYBQ%3D&reserved=0>
 - this was taken with the device set to a surround (7.1) mix format
  *
  *   
csgo-stereo.etl<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D1PMWPnjh7-EkTgWr0-MkM0UCd1Zv9jYXB&data=02%7C01%7CMatthew.van.Eerde%40microsoft.com%7C3317a66759144f001fd308d76df49202%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637098769513287140&sdata=nIK9sn7byY7AiAyGH7vCVIzj4YhsG18uhVAbEPLtDcM%3D&reserved=0>
 - this was taken with the device set to a stereo mix format and with 
surround-capable SFX APO
  *   
windows-media-player.etl<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F15NeVsgMFuXNJ8BHD-Q3jzkCNXNDyVLwF%2Fview%3Fusp%3Dsharing&data=02%7C01%7CMatthew.van.Eerde%40microsoft.com%7C3317a66759144f001fd308d76df49202%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637098769513297135&sdata=PuyBCehXUDNmAwNEqlrDZMQCrryM0cgSNl%2F%2FL0NJEv0%3D&reserved=0>
 - this is an attempt to play surround media via Windows Media Player, same 
setup (stereo mix format + SFX APO)
Please note that even though CS:GO is opening one instance of 5.1 session in 
csgo-stereo.etl, the actual game sounds are still routed via stereo sessions. 
And other games behave in a similar manner.

From looking at the stacks, it looks like it's the XAudio2 framework which is 
not doing the necessary format negotiations. It's crucial for our product to 
receive correct surround sound from games, so I'd like to know if there are any 
other ways to accomplish this other than fixing the mix format via a custom 
kernel driver.

Thanks,
Andrey

On Tue, Nov 19, 2019 at 11:47 PM Matthew van Eerde 
<dmarc-noreply@xxxxxxxxxxxxx<mailto:dmarc-noreply@xxxxxxxxxxxxx>> wrote:

  *   For some reason most (if not all) games don’t do any format negotiation

Let’s see if we can figure out what the reason is. Can you pick a 
non-format-negotiating game and grab IAudioClient stacks with your SFX, as 
described here?
https://matthewvaneerde.wordpress.com/2018/11/12/what-api-is-being-used-to-play-or-record-audio/<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmatthewvaneerde.wordpress.com%2F2018%2F11%2F12%2Fwhat-api-is-being-used-to-play-or-record-audio%2F&data=02%7C01%7CMatthew.van.Eerde%40microsoft.com%7C3317a66759144f001fd308d76df49202%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637098769513297135&sdata=NzwdRNUufzUANTImXeCcMqAe26dbRlwJgKy6JfDBAs8%3D&reserved=0>

From: Andrey Zui<mailto:dmarc-noreply@xxxxxxxxxxxxx>
Sent: Tuesday, November 19, 2019 1:40 PM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] Re: APO custom formats

Hello Matthew,

Thank you for your reply. I apologize, I forgot to mention that we've actually 
implemented SFX APO which accepts multichannel formats and then downmixes them 
to stereo (exactly what you've described).

Unfortunately, for some reason most (if not all) games don't do any format 
negotiation, and go straight for the mix format. So even though our SFX APO 
accepts multichannel audio, games still initialize it with stereo format (even 
though they do output true surround if we connect hardware that natively 
supports 7.1). I thought that adding surround format via EFX APO would fix the 
issue, but even though I've got the custom format to show up, I still get this 
"format not supported" error when I try to select it.

Provided that neither of our APOs get any IsInput/IsOutputFormatSupported calls 
with the custom format, and that APO registration flags also seem to be 
correct, do you know what else could be causing the "Format not supported by 
the device" error in mmsys.cpl?

Thanks,
Andrey

On Tue, Nov 19, 2019 at 10:44 PM Matthew van Eerde 
<dmarc-noreply@xxxxxxxxxxxxx<mailto:dmarc-noreply@xxxxxxxxxxxxx>> wrote:
Virtual surround sound is typically implemented in the SFX. The idea is that 
the audio API the game uses to stream will call IAudioClient::IsFormatSupported 
with the multichannel format; your SFX will succeed this; and then you can 
downmix to the mix format.

Custom EFX output formats are used historically for things like real-time 
compression of multichannel PCM to something like Dolby Digital or DTS which 
will fit over a limited-bandwidth S/PDIF transport. Search for “encoding GFX”.

From: Andrey Zui<mailto:dmarc-noreply@xxxxxxxxxxxxx>
Sent: Tuesday, November 19, 2019 11:51 AM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] APO custom formats

Hello,

I'm currently trying to expose custom formats supported by my EFX APO via 
IAudioSystemEffectsCustomFormats. So far I've managed to get custom formats to 
show up in the Advanced tab in Sound Control Panel (mmsys.cpl), but whenever I 
try to apply one of the custom formats I get "Format not supported by the 
device" error.

I've checked and it looks like APO's IsInputFormatSupported method is not being 
called with the new format at all. I've also tried setting various APO flags 
(including APO_FLAG_NONE) and it still didn't help.

At this point I'm wondering whether adding custom formats is still supported, 
since apparently this functionality was added back in Vista and after all these 
years I've only been able to find only a couple of discussions about it.

To add some context, I'm trying to add surround formats to a USB stereo headset 
to enable sound virtualization in games (since games tend to look only at the 
mix format). AFAIK usually this is accomplished via custom kernel driver, but 
I'd like to implement this without touching the kernel, if at all possible. 
(I've also heard that recent Windows updates brought some changes which might 
have helped, but after some testing it seems that the issue is still there, 
even on the latest Windows Insider builds.)

Thanks,
Andrey



Other related posts: