[wdmaudiodev] Re: APO custom formats

  • From: "Andrey Zui" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "andrey.zui" for DMARC)
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Thu, 21 Nov 2019 03:02:59 +0200

No, it does not. Is this a requirement?

If the kernel streaming pin factory supported this format, why would there
ever be a need to expose it via APO custom formats? Wouldn't the format be
exposed anyway?



On Thu, Nov 21, 2019 at 2:29 AM Matthew van Eerde <
dmarc-noreply@xxxxxxxxxxxxx> wrote:

Does the kernel streaming pin factory support the format you added to the
control panel?


------------------------------
*From:* wdmaudiodev-bounce@xxxxxxxxxxxxx <wdmaudiodev-bounce@xxxxxxxxxxxxx>
on behalf of Andrey Zui <dmarc-noreply@xxxxxxxxxxxxx>
*Sent:* Wednesday, November 20, 2019 2:17:57 PM
*To:* wdmaudiodev@xxxxxxxxxxxxx <wdmaudiodev@xxxxxxxxxxxxx>
*Subject:* [wdmaudiodev] Re: APO custom formats

Matthew, Michael,

Thank you for your replies. Unfortunately, it's crucial for our product to
support games like CS:GO.

I am aware that fixing the mix format via custom driver is an option, but
I also wanted to test if adding a custom format via APO would fix this
issue, as this is a lot easier and less error prone than writing a kernel
driver.

However, as I've stated in my previous emails, while I've managed to add
custom formats to the mmsys.cpl dropdown, when I try to apply it I get
"Format not supported by the device" error. APO registration properties
seem to be correct, but for some reason APO's IsInputFormatSupported is not
being called with the custom format at all.

If the CS:GO issue comes from the fact that XAudio2 uses the mix format
then theoretically adding custom surround formats should help.

I'm just curious why I'm getting this "format not supported" error.

Thanks,
Andrey

On Wed, Nov 20, 2019 at 11:09 PM Michael Johansen <johansen.mic@xxxxxxxxx>
wrote:

Andrey, I am afraid that if you want to do that and get it to work with
older games like CS:GO you will have to write your own driver.

BR,

Michael

Den ons. 20. nov. 2019 kl. 21.55 skrev Matthew van Eerde <
dmarc-noreply@xxxxxxxxxxxxx>:

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 <dmarc-noreply@xxxxxxxxxxxxx>
*Sent: *Wednesday, November 20, 2019 12:02 PM
*To: *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%7C0b0df79a79c74b64a78b08d76e079ada%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637098851254108582&sdata=RPL72AU15kzwqocSuCPkzhBnhvTiIhjp635LPn2B50w%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%7C0b0df79a79c74b64a78b08d76e079ada%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637098851254108582&sdata=dai1kvJcD%2FWvU8bpBAs3uG0JEO6fTN4GZsMkpaStFIY%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%7C0b0df79a79c74b64a78b08d76e079ada%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637098851254118534&sdata=Y4We4CRltbKeOxcyBDi0DEWYN7Kp7gvJq3SncWGqEvE%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> 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%7C0b0df79a79c74b64a78b08d76e079ada%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637098851254118534&sdata=mBLVrH2UWJQd33b97Z7YVADEGCUnPtIJqW4ggExj3V4%3D&reserved=0>



*From: *Andrey Zui <dmarc-noreply@xxxxxxxxxxxxx>
*Sent: *Tuesday, November 19, 2019 1:40 PM
*To: *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> 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 <dmarc-noreply@xxxxxxxxxxxxx>
*Sent: *Tuesday, November 19, 2019 11:51 AM
*To: *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: