-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
SPU2: Replace SndOut with AudioStream from DuckStation #11135
Conversation
Resolves #432? |
No, this is not DTS decoding/passthrough. |
This setting is useful on underpowered systems Also I'm surprised to learn that is breaks every game. From what I'd been told it only really adversely affected a single rhythm game. |
I have not an underpowered system and yet Async mix is useful for a game when the audio stutters no matter which syncronization mode i use. Keeping it, even if advising it can break games is the best solution in my opinion. |
It breaks a game that synchronizes anything to audio. FMVs, speech, sound effects, etc. I've decided I'm keeping it scrapped, because it relied on a bunch of expressions that make absolutely no sense. If someone wants it that desperately, feel free to re-add it in a follow-up PR. |
Also, should FreeSurround not be in 3rdparty? |
It's basically a single file (the channel maps could go in the main file, even), and can benefit from AVX2. 3rdparty doesn't have AVX2 configs in MSBuild. Edit: actually, why don't we have AVX2 for 3rdparty in MSBuild... that doesn't make any sense... |
AVX2 is a pretty good reason. On that note, what about cmake builds using |
Is that the case even with this PR? responsiveness has changed. |
I've removed the discrepancy between core and 3rdparty, so I moved it out. It doesn't make use of the wider vector width, so it's not going to make a non-trivial difference. Main benefit would just be more registers. But I doubt it's worthwhile complicating it with Multi-ISA. |
Perhaps as a compromise, "Async Mix" can be restricted to only activate while turbo and slow modes are active? I generally quite like the feature, and I usually don't see it cause any problems provided the game runs at full speed and isn't dropping frames - only exception in my own library is Xenosaga 2 where the cutscenes play at half speed with it. I like it because I don't really like the pitch shift that comes from accelerating the audio playback, nor the effects of tiemstretching (nor its pitch correction) on the results. And this one's more personal, as I am a developer myself. Another is Final Fantasy X, which relies extremely heavily on both audio cues and animation cues to progress its cutscenes, and I found it fascinating how the characters would return to T poses at times. While I can understand it's a support burden, I hope you'll at least reconsider. |
but if you're turboing or slow mode, you aren't at full speed. you're either side of it. Async mix is problematic as it messes with the emulation, since it's requesting audio samples at a different frequency to what is expected, and there's a whole bunch of games which don't like this behaviour. I can understand Stenzeks unwillingness to re-add it, it's a very hacky solution to a problem. In regards to fast forwarding, in this PR it should sound a lot better now than it did. It will still be sped up (i mean the game is running fast, what do you expect?) but it'll be much smoother than it was.
I'm not sure what this has to do with async? if the cutscenes are running slow but you want to async the sound, it just means all the sound fx and speech are going way out of time with what's happening, can you explain how this is a good thing? |
With all the optimization work we've done throughout 1.7, you'd have to either have a very slow PC (as in, dual-core, probably >10 years old), and be trying to run a heavy game, to not be able to maintain full speed. So that side of async is kinda redundant these days. But it's mainly because I can't be arsed to reverse-engineer the formula it used to screw with the tick interval. Which I'm pretty sure would break even more fantastically if the speed varied, and wasn't constant. "haha it breaks the game in funny ways" isn't a reason to have a feature... Users see that, and think PCSX2 is rubbish as a result, worsening the unjustified negative reputation we have amongst some. |
I'm more just stating that where the target isn't "100% speed", Async Mixing is at its most desirable. It's more that I personally don't want the audio sped up in turbo mode.
As I understand it, Jak 2/3 uses silent audio cues for time keeping. I mentioned it more as a interesting curiosity that the current Async Mix implementation reveals. |
But it's not normal. Because you could easily run out of voices, and lines could get missed entirely, which will just result in them being missed at best, or softlock/crash the game at worst. I can see the advantage here, but it's really not worth the risk of breaking games for users. |
Yeah, unfortunately it still happens. The drops are too steep to be smoothed out. Audio stutter is pretty noticeable. The game I am talking about is PES 5, I already mentioned it on Discord, those drops from 60 to 50 fps last less than half second but they are enough to make the sound stutter. Maybe there is a way in this PR to make audio synchronization less sensible to half second fps drops, I didn't test every setting. |
The higher the buffer size (=> target latency), the less impact frame time spikes will have, and/or rate drops, since the stretcher will have more of a buffer to catch up. |
Okay, the update fixes the issue of not being able to adjust volume per-game, good job... Now there is a new bug where changing the volume at all will crash the emulator on linux, like just moving the sliders for both the fast-forward and normal volume in both per-game and global audio settings will just froze and crash the appimage. The appimage spits this on the terminal: Video of it happening: |
Sometimes I wonder how Avx2 isn’t just the minimum standard. It’s been around since 2013. |
Because of intel doing shitty market segmentation by arbitrarily excluding it from low cost models. |
This looks good, and from quick testing it seems to behave better than the old output system. I'm also fully in favor of getting rid of async. |
I'll second async mix being useful here (5900X / RTX 4080), there's always some very heavy game that dips for a little tiny bit and async mix smoothes that out, then again if it's only async mix and not both async mix and none that's gone that's fine. |
Master: Maybe set it back to the older and lower latencies? Though some weird behaviours when I press Minimal Checkbox the first time, and unchecking does make it the old master default again: Because default is 50 + 50, when I press Minimal it does 50 + 10 and uncheck it, it is 50 + 20 essentially. |
I assume they meant listing it in the PR description (i.e. like you did with Async) |
We discussed it internally, so it's not like nobody was aware :) Remember, they're nightly builds, so anything is subject to change. Async was a possible point of contention, hence why I mentioned it. Edit: I forgot, it was also a late change, the initial version of the PR still had an XAudio backend... I tossed it later on due to latency issues, and my slack ass didn't update the original post. |
It wasn't just volume difference, that'd be easy to fix by increasing volume. It was more like parts of the music sounded quieter than they should, while the volume level was the same. |
That's impossible. The frames generated by the emulated SPU2 are the same regardless of the backend. |
Record both XAudio & Cubeb and compare them, either by listening or comparing the outputted waveform, and tell us, more specificity, where it differed (along with providing the recordings) |
I thought of doing that but I dont even know how to do it and it would be too much work anyway. I only compared them by listening (switching back and forth between them) |
That would imply that xaudio is doing further audio processing to cause this impression. Since we've not knowingly enabled such a thing I would suggest it is undesirable. |
X3DAudio HRTF wouldn't be able to add full 3D audio (which is the main goal) even with XAudio2 alone, perhaps only virtual surround, if XAudio2 was also using X3DAudio. Anyhow, going back on topic, here's a quick test of the new surround decoder using HeSuVi (system-wide surround virtualization for headphones) https://youtu.be/fWIUJqPfpNA |
There is no such thing. The SPU is inherently 2channel, DPLII is "encoded" on the fly using its volume registers (it supports setting negative volumes to invert the phase). The digital formats are usually only used for prerendered FMV's (although some games dynamically encode DTS on the CPU) |
I see. I think I misinterpreted that issue so my apologies 😅 |
No, the SPU does not support outputting anything other than stereo via mixing. There's no registers for anything other than left or right volume, for each voice. You'd have to define some other emulated interface for getting the sound out of the game, and that would involve very intensive reversing and patching. I say this too many times, emulators are not magic. |
There's not really any opportunity to do so. All the SPU gets is a left and right volume per sound channel. All sound positioning is calculated by game code. |
This comment was marked as spam.
This comment was marked as spam.
Hello i'm using laptop and set power plan to high performance, but sometime it's still get frame drop there is my laptop specs for running pcsx2: I hope async mix can back for future update |
if your hardware isn't able to maintain full speed, you should use an older version if the sound speed is a problem (and considering the speed drops, it's a least of your problems). I would however look at trying to improve your performance of your laptop, it shouldn't be terrible. |
Undervolt certainly could help squeezing an extra 10 or even 20 percent improvement (especially on coffee lake). |
I've been trying to search what commit that removed the Async Mix and it was this |
You definitely didn't want to use async mix for rhythm games, or anything that requires tight synchronization. It's going to be wrong. |
Without the Async Mix the rhythm would feel wrong |
Async mix would be the worst thing as the music will keep going way ahead of the actual game, that's completely the opposite to what you want on a rhythm game. I would suggest joining the discord and see if anybody can give you suggestions on how to squeeze a bit more performance out of that laptop, if we can |
Losing Async Mix is quite unfortunate for MGS3, which is very resource intensive and otherwise had no bugs with the option enabled. The game normally drops frames on PS2, but on pcsx2 it experiences slowdowns instead (and seems to target 60fps during many cutscenes instead of 30fps on PS2). Async Mix used to fix this and allow the game to drop frames like PS2. Also, for Metal Gear Online changing the emulation speed is frowned upon because it messes with the server. Without any alternative, players with weak hardware will unintentionally harm the game for others. |
Hey, stenzek, i understand that you removed this option since it can cause unnecessary trouble to you developers, but i really really miss that option, i only used with midnight club 3 and never had any issue with it, i could speed up the game in some slow parts like the garage or the loadings and still enjoying the game amazing soundtrack basically a QOL thing for me, if it is not too much to ask, can you please consider bringing it back? i do really appreciate your efforts in making this project bigger and better. |
No it will not be coming back. |
If someone wants to properly implement an async mix option, they can go ahead and pr it. I, and some others after internal discussion, believe that it is a useful option for those games that are just a little too demanding for the host hardware. It's just a matter of who wants to implement it. |
Description of Changes
Guts the cruddy SndOut code that I've patched up so many times over the last couple of years, and replaces it with my.. erm.. nicer AudioStream class from DuckStation.
This has the benefit of:
Currently, Async Mix has been removed.
If you are depending on this feature, please let us know in this thread, and we'll consider re-introducing it. But personally I think it should stay gone, it breaks every game it touches in some way.
Rationale behind Changes
See above.
Suggested Testing Steps
Test audio-related things, including: