Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TESTERS NEEDED] cellAudio: Implement audio format options, scrap downmix options #12112

Merged
merged 17 commits into from
Jun 2, 2022

Conversation

Megamouse
Copy link
Contributor

@Megamouse Megamouse commented May 28, 2022

This enables the downmix mode "Use application settings".
The game can now decide which channel count is used with cellAudioOutConfigure.

  • Scrapped the downmix settings entirely in favor of audio format selection as seen on PS3.
  • The dropdown only allows one selection for now.
  • You can use "Automatic" to let the game decide based on its own PARAM.SFO "SOUND_FORMAT" value
  • In the future this will have to be adjusted to allow for multi-selection, since the PS3 seems to always report at least LPCM 2 Ch. 48k Hz and LPCM 2 Ch. 41 kHz.
  • I removed the unsupported formats in the custom configs, because some games will softlock if you choose the wrong format.
    Therefore I recommend using Automatic in the global config

image
image

@Megamouse Megamouse force-pushed the cellAudioOut branch 11 times, most recently from 599f8ac to b8e7dcc Compare May 28, 2022 13:45
@Megamouse Megamouse force-pushed the cellAudioOut branch 3 times, most recently from 4715fca to 4044c3d Compare May 28, 2022 22:11
@Megamouse Megamouse changed the title cellAudio: Implement application based downmix settings cellAudio: Implement audio format options, scrap downmix options May 28, 2022
@Megamouse
Copy link
Contributor Author

I completely reworked this PR.
Testers rejoice, you have work to do!

@Megamouse Megamouse changed the title cellAudio: Implement audio format options, scrap downmix options [TESTERS NEEDED] cellAudio: Implement audio format options, scrap downmix options May 28, 2022
@Megamouse
Copy link
Contributor Author

Added automatic option

@Megamouse Megamouse force-pushed the cellAudioOut branch 6 times, most recently from 6d4fa7a to 6f9bab6 Compare May 28, 2022 23:56
@capriots
Copy link
Contributor

capriots commented May 29, 2022

Can't test just yet, but does automatic always choose the highest supported by the game? You probably don't wanna go above what the host audio system is capable of.
I don't think that option is necessary at all actually, if a game doesn't support the surround channels they would simply remain silent.
Users should just pick their speaker setup and games will see that and take care of the rest, just like on a PS3

@Megamouse
Copy link
Contributor Author

The issue is that some games may not like it if you don't provide a format that it can handle.
That's why on PS3 you always have some default stereo sound_modes enabled.
And there is currently no way to tell which formats are supported by the system.

I could add a second automatic stereo option that omits all surround formats. idk

@Megamouse
Copy link
Contributor Author

Added 2ch always by default.
Added 5.1 LPCM to 7.1 LPCM.

@Megamouse
Copy link
Contributor Author

you know what? I'll just add the stupid checkbox list xD

Would be nice to know if the current approach is working better now though

@capriots
Copy link
Contributor

capriots commented Jun 1, 2022

I would honestly prefer the dropdown menu. Especially if you choose to combine the 5.1 options. Then you could just name the options "Stereo", "Surround 5.1" and "Surround 7.1". So much better in my opinion.

@Megamouse
Copy link
Contributor Author

damn, saw your comment too late xD
already implemented it.

image

@Megamouse
Copy link
Contributor Author

I can still add three options that basically do what you suggested. I don't have to remove the manual mode.
I'll probably add them tomorrow

@Megamouse Megamouse force-pushed the cellAudioOut branch 2 times, most recently from 7ef6bee to dbe8204 Compare June 1, 2022 23:00
@Megamouse
Copy link
Contributor Author

Added. Please let me know if everything works as expected

@Megamouse Megamouse merged commit 06e5b8a into RPCS3:master Jun 2, 2022
@Linear524
Copy link

@Megamouse
An awesome PR !))
Killzone2,3 - now all front facing sound sources sounds loud and clear.
God of War 3 - ambient sounds works better (before it was like high-frequency parts of sounds was muted)
TLoU - works fine, no issues
GT6 - no sound issues, Stereo pan works like on PS3
Journey - sounds loud and clear, hights are not broken
Persona 5 - nice as usual
MGS4 - a lot of missing FX sounds and ambient sounds, but this bugs was before and it looks like an SPU issues...

@capriots
Copy link
Contributor

capriots commented Jun 2, 2022

Looking good
Found just one thing: When a disc game has an update installed, it seems the SFO in the update data is used to determine supported formats instead of the one on the disc. Since update SFOs don't contain any audio format information, the emulator will only detect stereo as supported format.

I also tested PS3 behavior a bit and I can confirm that cellAudioOutConfigure doesn't return any error codes if invalid settings are in the config struct. It simply continues to use the last valid config and returns 0.
...GetConfiguration returns whatever values were used to configure before, even if it was invalid, except for downMixer which appears to always be 0.
...GetState returns what is actually being output, except for downMixer again which is always 0.
The PS3 chooses the initial config when starting any game/app like this:
It goes through all possible formats in this order:
LPCM 7.1 -> LPCM 5.1 -> Dolby -> DTS -> LPCM 2.0
until it hits something that is both in the SFO and configured in settings.
That should probably be implemented because I found some games that expect the PS3 to pick something for them, and you could remove the Automatic setting since selecting 7.1 would be practically equivalent.

@Megamouse Megamouse deleted the cellAudioOut branch June 2, 2022 22:46
@Megamouse
Copy link
Contributor Author

Thanks. I'll cook something up when I have time

@Megamouse
Copy link
Contributor Author

what does cellAudioOutGetDeviceInfo return and in what order are the modes in info.availableModes returned?

@capriots
Copy link
Contributor

capriots commented Jun 4, 2022

With everything enabled it returns this:

 availableModes[00]: type:  0, channel: 2, fs: 0x7e, layout: 0x00000001
 availableModes[01]: type:  0, channel: 6, fs: 0x7e, layout: 0x00010000
 availableModes[02]: type:  0, channel: 8, fs: 0x7e, layout: 0x40000000
 availableModes[03]: type:  1, channel: 6, fs: 0x04, layout: 0x00010000
 availableModes[04]: type:  6, channel: 6, fs: 0x04, layout: 0x00010000
 availableModes[05]: type:  5, channel: 6, fs: 0x04, layout: 0x00010000
 availableModes[06]: type:  9, channel: 8, fs: 0x06, layout: 0x40000000
 availableModes[07]: type:  8, channel: 8, fs: 0x7e, layout: 0x40000000
 availableModes[08]: type: 11, channel: 8, fs: 0x7e, layout: 0x40000000
 availableModes[09]: type: 10, channel: 8, fs: 0x7e, layout: 0x40000000
 availableModes[10]: type:  0, channel: 0, fs: 0x00, layout: 0x00000000
 availableModes[11]: type:  0, channel: 0, fs: 0x00, layout: 0x00000000
 availableModes[12]: type:  0, channel: 0, fs: 0x00, layout: 0x00000000
 availableModes[13]: type:  0, channel: 0, fs: 0x00, layout: 0x00000000
 availableModes[14]: type:  0, channel: 0, fs: 0x00, layout: 0x00000000
 availableModes[15]: type:  0, channel: 0, fs: 0x00, layout: 0x00000000

Coding type 8 is Dolby TrueHD, 10 is DTS-HD and 11 is DTS-HD MA.
Latency is always 13 for me, no matter what I connect to my PS3.
When I use CELL_AUDIO_OUT_SECONDARY as first arg, info.availableModes only contains LPCM 2.0. I didn't have anything connected to my PS3.
Also, documentation says secondary output only supports LPCM 2.0 so we probably don't wanna add anything more as available. I'm gonna test some more later with USB audio devices, see how it behaves.

@Megamouse
Copy link
Contributor Author

which modes exactly are 8, 10 and 11 ?
I'll add them to the enums at least

@Megamouse
Copy link
Contributor Author

I won't sort the availableModes, I don't think it really matters.

@Megamouse
Copy link
Contributor Author

"Also, documentation says secondary output only supports LPCM 2.0 so we probably don't wanna add anything more as available. I'm gonna test some more later with USB audio devices, see how it behaves."

Ah, I mistook the primary out headset for the secondary out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants