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

[EAX] Reverb regression (commit d21ff67) #725

Closed
Kappa971 opened this issue Jul 5, 2022 · 17 comments
Closed

[EAX] Reverb regression (commit d21ff67) #725

Kappa971 opened this issue Jul 5, 2022 · 17 comments

Comments

@Kappa971
Copy link

Kappa971 commented Jul 5, 2022

Hi, the commit d21ff67 caused a regression in the reverb effect.
For example in Splinter Cell, from this commit onwards, reverb is also applied in radio dialogues, so the reverb is applied where it shouldn't.

I haven't tested other games, but the issue looks like this: kcat/dsoal#46

@kcat
Copy link
Owner

kcat commented Jul 6, 2022

Looks like there's a couple things here.

First, it seems when an EAX call is made, all existing sources are initialized with the default properties for the EAX version of the call (even if the call wasn't for a source), then they continue to use that version's properties until the source has an EAX property set which changes that individual source.

Second, any sources made after an EAX call will be initialized with the default properties for the EAX version of the last EAX call. So if you generate some sources, query an EAX4 context property, query an EAX5 context property, then generate some more sources, the first set will be using EAX4 default parameters and the second set will be using EAX5 default parameters, even though no EAX calls are made on the sources themselves.

However, this alone wouldn't be too much of an issue, as the only difference in source defaults is EAX4's active slots being {NULL, FXSlot0} (which is implicitly shared by EAX1-3 which don't otherwise have "active slots", just an implicit reverb effect), while EAX5's is {NULL, PrimaryFXSlotID} (where the default primary fx slot is slot 0, so you'd need to do some odd things to create different results). Except, EAX5 actually has two defaults for a source's active slots; the "3D default" being {NULL, PrimaryFXSlotID} and the "2D default" being {NULL, NULL} (not using any slots). Since a source isn't 2D or 3D until a buffer is attached (mono=3D, multichannel=2D), there's no way to know which of these should apply to a new source.

It could be that these different 3D/2D defaults are just API side for what the developer wants to use a source for and don't represent the actual EAX5 defaults for a source. Or it could be there's some point where a source's EAX properties are reset and a default used depending on its current buffer format. But that would need testing with actual hardware.

All that said, it seems there was a bug hiding a bug(?) in versions prior to that commit, where the source was being initialized with the "3D" EAX5 defaults, but the eax_has_active_fx_slots_ flag was left false, so the active slots wouldn't get applied (until either the active fx slots are set, or the context's primary effect slot is changed, when it would update the flag).

Unless hardware shows something different (like setting a source's buffer resets the source's EAX properties, or multi-channel sources don't have EAX applied regardless of the set properties, or if the game uses EAX5, the default active fx slots for EAX5 should be null), I think the source should be initialized with no active fx slots enabled separate from any version's defaults, until the app sets a source EAX property. A similar thing should probably be done with effects, to not have any effect set on the fx slot until the app sets an fx slot property (which would avoid having reverb+chorus running on an app that just queried EAX support but doesn't end up using it).

@Kappa971
Copy link
Author

Kappa971 commented Jul 6, 2022

Thanks @kcat for the detailed explanation.
It looks like this will take a lot of work. I await news. Thanks

@kcat
Copy link
Owner

kcat commented Jul 7, 2022

Actually I noticed something else. A source will always have the context's primary fx slot active, even if the source isn't set to use the primary fx slot. So that means with EAX4/5, all sources will always have fx slot 0 enabled (or whatever is set for the primary fx slot), even if the app sets null fx slots on the source.

@kcat
Copy link
Owner

kcat commented Jul 7, 2022

Try now with commit e2f5ceb.

@Kappa971
Copy link
Author

Kappa971 commented Jul 7, 2022

Thanks @kcat, now the reverb is no longer applied in the radio dialogue.
Is there more to do or can I close this?

@kcat
Copy link
Owner

kcat commented Jul 7, 2022

I think that should be it, if there's no other issue occurring here.

@Kappa971
Copy link
Author

Kappa971 commented Jul 7, 2022

Well, if I notice any other problems, I will report them. Thank you

@Kappa971 Kappa971 closed this as completed Jul 7, 2022
@Kappa971
Copy link
Author

Kappa971 commented Jul 9, 2022

This isn't inherent to the commit specified here, but playing Prey (2006) with OpenAL Soft you will notice a very heavy reverb effect in levels that with X-Fi and Host OpenAL (Creative) the reverb is very mild. The game uses EAX 5, maybe there is some hidden bug? Or is it about the different reverb management of OpenAL Soft (as mentioned in another discussion)?
In this case, however, the difference is very evident, I haven't noticed the same thing in other games like Unreal 2 (EAX 3), Doom 3 (EAX 4) (they sound quite similar to X-Fi, at least the first level, I haven't done a thorough test).

@bibendovsky
Copy link
Contributor

This isn't inherent to the commit specified here, but playing Prey (2006) with OpenAL Soft you will notice a very heavy reverb effect in levels that with X-Fi and Host OpenAL (Creative) the reverb is very mild. The game uses EAX 5, maybe there is some hidden bug? Or is it about the different reverb management of OpenAL Soft (as mentioned in another discussion)? In this case, however, the difference is very evident, I haven't noticed the same thing in other games like Unreal 2 (EAX 3), Doom 3 (EAX 4) (they sound quite similar to X-Fi, at least the first level, I haven't done a thorough test).

Doom 3 and Unreal 2 utilizes only one FX slot. While working on #705 and #720 I seen some issues with filters and using FX slots in comparison to EAX4 docs (I have to admit, only after EAX extention was integrated into OpenAL Soft, I noticed links to EAX4 docs on the wiki). I decided to postpone resolving those issues until I'll complete with states for each version: for FX slots (almost finished) and the context (yet to be done).

@Kappa971
Copy link
Author

Kappa971 commented Jul 18, 2022

With the latest version of OpenAL Soft, Prey (I only tried Prey) is still "broken" but in a different way than before. There is no longer the extreme reverb, but the change between different "environments" is not smooth but too fast (with a possible static noise, but this happened even before).
Also in a very specific point of level 2 (BarLevel-Level1-Level2), the sound becomes strange, muffled, it seems as if my head is underwater and the sound of the weapon seems to move to the right, I don't know it's really strange.
I forgot to disable CMSS-3D, but I don't think it was the cause of all this.

I recommend, if you don't already have it, to retrieve a copy of Prey (2006) because I think it is an excellent benchmark for EAX (5.0).

@kcat
Copy link
Owner

kcat commented Jul 19, 2022

There is no longer the extreme reverb, but the change between different "environments" is not smooth but too fast (with a possible static noise, but this happened even before).

OpenAL Soft doesn't interpolate between reverbs as well as I'd like. Some filters don't interpolate at all (which can cause clicks in some circumstances), while what does interpolate happens over the course of the update. When listening to hardware, it sounds as if it actually runs a second reverb when it switches presets, letting the original decay naturally with its old properties at the same time that a new one starts with the updated properties. But I'm not sure how that's supposed to work efficiently with the app providing continuous updates for dynamic environment modeling, as it would cause/require a lot of overlapping reverbs running in parallel to avoid audible drop-outs.

The Effects Extension Guide for OpenAL/EFX mentions the early reflections and late reverb delay, panning, and gain properties can be updated relatively frequently (25 to 30 times per second, the same rate most source/listener properties should be updated), while others should be less frequent (10 to 15 times per second), indicating changes to the reflection/reverb properties can more simply interpolate the existing effect while the other properties do some more intensive change. But even at that reduced rate, a completely separate parallel process would still need a lot of overlapping instances given how long the reverb tail can be.

@bibendovsky
Copy link
Contributor

Also in a very specific point of level 2 (BarLevel-Level1-Level2), the sound becomes strange, muffled, it seems as if my head is underwater and the sound of the weapon seems to move to the right, I don't know it's really strange.

Do you have a saved game to test the issue?

@Kappa971
Copy link
Author

Kappa971 commented Jul 19, 2022

OpenAL Soft doesn't interpolate between reverbs as well as I'd like. Some filters don't interpolate at all (which can cause clicks in some circumstances), while what does interpolate happens over the course of the update.

This makes the audio in games a bit "broken" because there is a quick change of effects from one room to another with often an audible click.

Do you have a saved game to test the issue?

I have the full 132mb game save, it won't let me load it. However, it doesn't take more than 10 minutes to get to level 2.
I noticed that, with the X-Fi, in Prey the reverb is very subtle... well, at the beginning of level 2 there seems to be no reverb with the X-Fi while with OpenAL Soft there is a slight effect.

Anyway, this is the problem I'm talking about:

  1. OpenAL Soft: prey_OpenALSoft.zip
  2. X-Fi: prey_X-Fi.zip

@bibendovsky
Copy link
Contributor

I have the full 132mb game save, it won't let me load it.

You don't have to provide all saved games, just only one with problematic level is enough.
Or you could at least to make a screenshot of the location with the issue.

There is no longer the extreme reverb, but the change between different "environments" is not smooth but too fast (with a possible static noise, but this happened even before).

Now this is explains why the wrapper had problems with EAX call pattern in Mass Effect (2007):

  1. The wrapper itself does not commit EAX objects on OpenAL 3D listener / source call , or the source begins to play (but that is another story).
  2. Reverb morphing takes some time on hardware and HOAL, while OpenAL Soft changes the effect almost instantly.

@Kappa971
Copy link
Author

Kappa971 commented Jul 20, 2022

You don't have to provide all saved games, just only one with problematic level is enough.
Or you could at least to make a screenshot of the location with the issue.

These two videos show where it happens (Level 02: Downward Spiral): #725 (comment)

EDIT
The Level 2 game save should be this (copy to C:\Users\%username%\Documents\My Games\PREY\base\savegames): SavegameLevel2.zip

@Kappa971
Copy link
Author

Hi @bibendovsky, did you then take a look at Prey?

@bibendovsky
Copy link
Contributor

Hi @bibendovsky, did you then take a look at Prey?

Sorry, not yet.

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

No branches or pull requests

3 participants