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 strength #365

Closed
vlad54rus opened this issue Apr 9, 2021 · 23 comments
Closed

EAX reverb strength #365

vlad54rus opened this issue Apr 9, 2021 · 23 comments

Comments

@vlad54rus
Copy link

While dhewm3 provides support for EAX, some reverb zones in Doom 3 have stupidly high reverb strength. Creating alsoft.ini file with the following content reduces it to a more acceptable levels:

[reverb]
boost=-7

Can you consider supplying this file with the release builds?

@dezo2
Copy link

dezo2 commented Apr 11, 2021

Thanks for the tip, I didn't know this can be adjusted using local ini file.
The default amount of reverb is indeed ridiculous.

@DanielGibson
Copy link
Member

I'll try to create a cvar to set this, apparently something similar to that boost setting can be done with alAuxiliaryEffectslotf(slot, AL_EFFECTSLOT_GAIN, gain); where gain is a value between 0 and 1 (1 by default; 0.5 should be similar to boost=-7).

I was also told that there's openal warnings when quitting the game (when setting env var ALSOFT_LOGLEVEL=2 or 3 when starting the game) about effect slots being deleted while there's still sources attached to them - most probably because idSoundWorldLocal::Shutdown() first deletes the listenerSlot and later the emitters which contain the sources.

DanielGibson added a commit to DanielGibson/dhewm3 that referenced this issue Apr 12, 2021
…ewm#365

It can be set to a value between 0.0 and 1.0, 1.0 is default
@DanielGibson
Copy link
Member

Hi, can you test if the build linked in #363 (comment) fixes your issues?
Remove the boost setting from your alsoft.ini and in dhewm3 set the s_alReverbGain to 0.5 or whatever sounds best for you:
Open the console (Shift+Esc), enter s_alReverbGain 0.5.

(In case you're not using Windows, check out this branch and compile dhewm3 yourself: https://github.com/DanielGibson/dhewm3/tree/reduce-dependencies)

@nbohr1more
Copy link

I locally merged this into The Dark Mod but it doesn't seem to have any affect.
We may have a few local deviations that break compatibility.

That said, when I began looking into this I found that the master volume for all EFX definitions is controlled by the "room" parameter. My plan was to hook into whichever branch accepts that parameter.

@DanielGibson
Copy link
Member

No idea about TDM, but in dhewm3 s_alReverbGain 0.5 definitely makes a noticeable difference, 0.1 or 0.0 even more so, of course (if EAX is enabled; 0.0 sounds like when it's disabled).

The "room" parameter sets reverb gain (AL_EAXREVERB_GAIN) for the current area, I think setting AL_EFFECTSLOT_GAIN on the slot should have about the same effect, but for everything that uses the slot (theres one listenerSlot per soundworld, and two soundworlds: one for the menu and one for ingame).
I think setting it on the slot is the cleanest way to do it if you want a global setting, otherwise you'll have to

  1. set it for all effects (and change it if the cvar changes!)
  2. keep ugly special cases in mind, like "what if the .efx file doesn't set room at all?"

No idea why it doesn't seem to work in TDM, maybe you have more such slots or you just didn't have EAX effects enabled or whatever; it's probably worth debugging

@nbohr1more
Copy link

I agree that the slot approach is the best, I really don't want to do this junk:

else if ( token == "room" ) {
efxf(AL_EAXREVERB_GAIN, mB_to_gain( (src.ParseInt() * tdm_offset_junk_int ) , GAIN));

but it should work...

The change takes effect in real-time right ?
The setting also overrides alsoft.ini ?

@DanielGibson
Copy link
Member

DanielGibson commented Apr 13, 2021

(src.ParseInt() * tdm_offset_junk_int

you don't want to make it an int but a float, otherwise it can't decrease the value (only to 0) and I have no idea what any number even means there, like, is 0.5 half as strong or what? after all, DB is logarithmic..

The change takes effect in real-time right ?

if you do it my way: yes. if you do it your way: no (the EFX files aren't re-parsed all the time)

The setting also overrides alsoft.ini ?

no, as far as I understand the [reverb] boost=.. setting in alsoft.ini is applied globally on top of whatever gains are set in the applications, like an additional factor or whatever

@vlad54rus
Copy link
Author

On the new build EAX is buggy - any changes in EAX zones and cvars only apply when i hit ESC button.

@DanielGibson
Copy link
Member

DanielGibson commented Apr 13, 2021

On the new build EAX is buggy - any changes in EAX zones and cvars only apply when i hit ESC button.

interesting. hmm.. might be caused by 13ac657 (but then the code was already pretty broken before and just worked accidentally)

UPDATE: in fact it seems to be caused by the following line (doesn't happen when I comment it out): https://github.com/DanielGibson/dhewm3/blob/55fc1023373b4c7dd50bdbbd70d87febfc0a65dc/neo/sound/snd_world.cpp#L528
Doesn't make much sense to me, I'll ask the openal-soft developer about it.

@DanielGibson
Copy link
Member

Hmm seems like this problem only happens in new(er?) versions of OpenAL - 1.21.1 (which is bundled with that test build) has it, 1.19.1 (which was bundled with the official 1.5.0 release binaries) doesn't.
I'll have to investigate.

@DanielGibson
Copy link
Member

Ok, this is a bug in openal-soft, their maintainer already found out what causes it.

I'll likely implement a workaround in dhewm3 to make sure this bug won't turn up in linux distros shipping affected openal-soft versions

DanielGibson added a commit to DanielGibson/dhewm3 that referenced this issue Apr 14, 2021
…ewm#365

It can be set to a value between 0.0 and 1.0, 1.0 is default
@DanielGibson
Copy link
Member

#363 (comment) has a new testbuild that should fix the issue by working around the openal bug (and, TBH, the code is better now)

@nbohr1more
Copy link

We have some divergences but I was able to merge this and get the feature working! THANK YOU!!!

@DanielGibson
Copy link
Member

awesome!

@vlad54rus
Copy link
Author

Works great, thank you.
Maybe make 0.5 the default value?

@dezo2
Copy link

dezo2 commented Apr 14, 2021

The new cvar for reverb works perfect, but now all looped ambient "music" stops after a few seconds of playing.
Edit: added a save - open it in 1.5.1 and then in the 1.5.2 test build.
mcu_save.zip

@DanielGibson
Copy link
Member

Maybe make 0.5 the default value?

hmm, maybe, I'll think about it

now all looped ambient "music" stops after a few seconds of playing.

thanks for reporting (and for including a savegame!), I'll look into that - at least short loops seemed to work when I tested, but sound files longer than 6 seconds or so are handled differently. most probably this is related to the switch to stb_vorbis, but we'll see.

@DanielGibson
Copy link
Member

@dezo2: Somehow your savegame doesn't load properly ("WARNING: Real Script checksum didn't match the one from the savegame!"), maybe you have some mod with its own scripts installed in base/?

Could you just post a screenshot of the right place to hear the sound?

DanielGibson added a commit to DanielGibson/dhewm3 that referenced this issue Apr 24, 2021
while at it, print errors when stb_vorbis_* calls fail.

fixes dhewm#365
@DanielGibson
Copy link
Member

Ok, I found the place and fixed the bug, I'll post updated Win32 binaries later

@DanielGibson
Copy link
Member

Here's new Windows binaries with all the changes of that branch including the latest fix for the looping sound issue, can you test if it works for you? Thanks! :)
dhewm3-1.5.2pre-win32-reduce-deps-fixed.zip

@dezo2
Copy link

dezo2 commented Apr 24, 2021

Hi Daniel, I tried multiple levels with this pre-release and all looped sounds are working again.
Thank you for fixing!
PS: The save was from clean 1.5.1 (no mods) - all older saves will cause this warning I think.

@DanielGibson
Copy link
Member

That's good to hear, thanks a lot for testing!

Weird that the savegame didn't work though.

DanielGibson added a commit to DanielGibson/dhewm3 that referenced this issue Apr 26, 2021
…ewm#365

It can be set to a value between 0.0 and 1.0, 1.0 is default
DanielGibson added a commit to DanielGibson/dhewm3 that referenced this issue Apr 26, 2021
while at it, print errors when stb_vorbis_* calls fail.

fixes dhewm#365
DanielGibson added a commit to DanielGibson/dhewm3 that referenced this issue Apr 27, 2021
…ewm#365

It can be set to a value between 0.0 and 1.0.
1.0 sounds like it did before introducing this cvar; as many people
found the the effect way to strong, I made 0.5 the default value
@DanielGibson
Copy link
Member

It's all in master now, s_alReverbGain now defaults to 0.5

rorgoroth pushed a commit to rorgoroth/dhewm3 that referenced this issue Apr 8, 2023
…ewm#365

It can be set to a value between 0.0 and 1.0.
1.0 sounds like it did before introducing this cvar; as many people
found the the effect way to strong, I made 0.5 the default value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants