Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Use IsFormatSupported() instead of GetMixFormat() #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Use IsFormatSupported() instead of GetMixFormat() #1

wants to merge 1 commit into from

Conversation

TheFireKahuna
Copy link

@TheFireKahuna TheFireKahuna commented Aug 9, 2017

Allows Windows to output 5.1/7.1 surround if an audio processing object (APO) such as Windows Sonic/Dolby Atmos supports higher channel output's.

Supports Windows 10 Spatial Sound in shared mode.
https://msdn.microsoft.com/en-us/library/windows/desktop/dd370876(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/mt807491(v=vs.85).aspx
https://www.reddit.com/r/xboxone/comments/6bzb8w/dolby_atmos_for_headphones_is_now_available_in/djd58ng/

Also quick note, 'ignoreSystemChannelMixer' option should be set to false, else it will not output surround sound with Windows Sonic/Dolby Atmos.

Allows Windows to output 5.1/7.1 surround if an audio processing object (APO) such as Windows Sonic/Dolby Atmos supports higher channel output's. Supports Windows 10 Spatial Sound in shared mode.
@kasper93
Copy link

kasper93 commented Aug 15, 2017

Have you actually tested it? This API is used little further in this function, and select format based on priority. I will look at it closer tomorrow.

@TheFireKahuna
Copy link
Author

It works for me with the stock Windows 10 USB Audio 1.0 driver on the newest Insider build. To test it, as long as your on the Creators Update just open up your Playback settings for your device, go to Spatial Sound and select Windows Sonic or Dolby Atmos for headphones. If you get 5.1/7.1 when its enabled, then the commit works. It might work better with a HResult fallback to GetMixFormat() to ensure it doesn't CTD.

I did get some crashes, but I'm running an Insider build using the Creator's Update SDK and VS v141. Plus, I get crashes regardless due to Realtek drivers and my Creative E1. I'm not very reliable for any crash testing.

@kasper93
Copy link

I've validated current code and it is perfectly fine. Let me explain how it works.

  1. GetMixFormat() is used to receive device format.
  2. Depending on the mode (shared/exclusive) IsFormatSupported() is called.
  3. If exact format is supported by the device it will be used. There is exception for system downmixing. We do not wont any other processing.

Windows Sonic/Dolby Atmos is supported. And will work if format is accepted(supported) by Windows. I needed to set 24-bit 48kHz in windows setting because otherwise it doesn't accept multinuclear mode.

In short Windows mixing is supported if you use Shared mode and disable "ignore system mixer..." option. And if audio device accept given format - (IsFormatSupported() return NULL in pClosest).


Now why your patch is not correct. Firstly it would break down mixing detection in Sanear. But more importantly it just crashes if audio device accept given format. If format is supported IsFormatSupported() will set last argument to NULL. And it this case this patch crashes because we try to dereference null pointer. But that's not important since the fix is wrong anyway.

I'm not closing for now if you want to discuss this further.

@TheFireKahuna
Copy link
Author

Right, so the Ignore System Mixer option does work, just worked in the reverse of how I thought it did. Then yeah, this patch is unnecessary. All that needs to be done is for that checkbox to be exposed in the MPC-HC nightly, and the newest Sanear should be 100% supported.

Good to hear that there's some more safe, clean code that allows us to use System Downmixing.

@TheFireKahuna
Copy link
Author

Tried the recent build, and noted that the 'Ignore System Channel Mixer' option doesn't save on exit, it resets itself.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants