Handle audio SRC mixing more correctly#12147
Conversation
sceAudioSetFrequency is kernel mode only, and it sounds like it changes the audio controller clock (didn't test.) SRC only affects the SRC channel. Currently, this doesn't actually use the sample rate yet, but at least it's tracked appropriately.
|
Yeah, definitely the right way to go. Do we know any games where this misinterpretation is actually causing issues? Either way should be fixed. Could we merge the first two in the meantime? The problems of the experimental resampling could be fixed with the same two-sample buffer technique we use in SasAudio. |
|
Did some quick testing finally - for example, Doodle Fit is unmistakably helped by this. Couldn't tell if there were timing problems (it's a simple puzzle game), but the music is so much better. I think the experimental resampling is significantly better than current master for all cases. Maybe we should just merge as is for now? I was thinking of reusing the same resampler class, but there were some complexities. A reformat of the reporting data:
22.05kHz is by far the simplest case, since we'll just pull half the samples and double them up. I suspect some of the others are based on user-provided music, except Elminage (#9819.) -[Unknown] |
|
Yeah, let's merge and see how it goes. We'll probably need to extend the savedata again for saving of the little buffers when the resampler is fully corrected, but predicting what will be needed is not really worth it since we might get it wrong. |
This fixes some return values and handles sample rate conversion to a very basic degree.
Per tests in hrydgard/pspautotests#202, the SRC functions of course don't affect global audio frequency, and are just sample rate converted. As of master without this code, we ignore their sample rate which means we consume their samples at an incorrect rate, which affects both playback and timing.
These changes make the tests much closer, although some of the timing is still off.
Games probably using sample rate conversion:
https://report.ppsspp.org/logs/kind/715?status=any
(ignore it being set to 0, that means don't perform conversion.)
Have not tested any of those games, and obviously the experimental resampling is ugly.
-[Unknown]