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
Remove effect prioritisation to fix segfaults #6214
Remove effect prioritisation to fix segfaults #6214
Conversation
Incidentally... ppy/osu#27466 (comment) That's windows too by the way. |
Ooh. Well there you go, straight from the horse's (Windows error description's) mouth 😄 I forgot about that. |
Hmm, while I don't believe we're using effect priorities in osu! (yet), I should mention that this change may result in unexpected behaviour whenever the order of effects are changed on a mixer. Not all audio effects are transitive (e.g. compressor->reverb does not result in the same output as reverb->compressor), so if someone using framework reorders effects expecting the output to change and it doesn't (due to this PR), it may lead to some confusion. I almost think the alternative of a "short glitch" would be preferable, as at least the resulting behaviour (effects processing in the correct order) would be as expected from a user's perspective. Ultimately this is probably an edge-case that likely no-one will hit, but I could see it potentially happening for a DAW/DJ application for instance, or as a stretch, a game with dynamic effects applying and mutating realtime in response to... stuff. |
For now I'm banking on mixers being unused by anyone other than us, so the important part for me at this point is whether that will have an effect on our existing usages. Effect prioritisation is pretty awkward right now, along with the whole replace-effect-at-index-to-update thing... (not to mention in going through the code I found potential out-of-range indexing 🙈, it's all so bad) I'm also considering that we're still lacking nested mixers. With nested mixers, wouldn't effect prioritisation either become a non-issue or become an explicit detail for special cases like you mentioned (due to performance, if anything)? Edit: Also wanted to mention that I'll be spending a weekend or two rewriting mixers because of this. |
Yeah I agree, the effect handling in framework is a bit... not great... at the moment. For the time being, removing
I'm not sure I see how nested mixers alleviates anything though? With each mixer having its own list of effects, we're just nesting the problem at that point? 😅 We could probably workaround this in the future by setting priority at effect creation time and then never changing it. Likely that'll be enough for our needs anyway. Regardless, surely the correct solution here is to get the segfault in |
Hmm, indeed it it would be nesting the problem... For that particular case I was imagining a structure like this:
(i.e. reverb applied first, then compressor second, not sure if correct but it's an example) Beyond performance concerns, do you imagine changing priority to be a more common operation, or for it to only be global like my example there? |
Honestly? I'm not sure we'll need effect priority changing for osu! itself at all. I imagine we'd be defining effect priority once (e.g. in a I can't really think of any scenarios for osu! off the top of my head where we'd need to alter effect priorities after the fact. |
I intend for this to be a somewhat temporary change because this entire thing needs to be rewritten... As far as I can tell we're not relying on effect priorities in osu! (cc @nekodex ).
We've had issues with
FXSetPriority
segfaulting the test runner in the past, but it has not been reported to be doing the same in-game: ppy/osu#27338I haven't been able to repro this in osu!framework, but, under pipewire the game should segfault when entering
PlayerLoader
with the following diff applied:I considered the alternative of instead removing and re-adding the effects. This causes a short but noticeable glitch when player load finishes.
What's the cause of all of this? I don't know. Likely some sort of x86-register dependent behaviour in BASS (wouldn't be the first time). It's a bit too deep for the time being.