kcat / dsoal

A DirectSound DLL replacer that enables surround sound, HRTF, and EAX support via OpenAL Soft
GNU Lesser General Public License v2.1
387 stars 51 forks source link

Beyond Good and Evil Echo doesn't work? #82

Open UserGit-2021 opened 1 year ago

UserGit-2021 commented 1 year ago

https://youtu.be/hoOr3E6mNC8 https://youtu.be/K2LvZJ04QLE dsoal_error.txt alsoft_error.txt alsoft.txt

I think echo works better in Alchemy. I don't hear echo in DSOAL. изображение изображение

kcat commented 1 year ago

Regarding those EAXSet errors, we might need to get some input from @bibendovsky. The docs I have for EAX2 clearly says Environment Diffusion ranges from 0 to 1, and the presets use that range. Though I do know some reverb APIs would have a Diffusion setting that ranges 1 to 100 (FMOD's reverb struct actually has two Diffusion members, EnvDiffusion ranges [0...1] and Diffusion ranges [1...100]). Maybe EAX3 or 4 reverb changed the range, and/or maybe there's some compatibility hack for when 1 < Diffusion <= 100, divide it by 100. Or maybe the value should be clamped instead of rejected.

Whatever the issue is, it seems to be preventing the reverb environment from changing since the game sets EAXREVERB_ALLPARAMETERS for EAX3 to update the reverb, where the invalid Diffusion value causes an error so nothing changes. Maybe it should ignore individual invalid values when setting all parameters like that.

Something interesting I see in the DSOAL log, though, is this:

1ff4:fixme:dsound:DSBufferProp_QuerySupport Unhandled propset: {a94047c0-1cef-11d3-bdb8-00c0f02ddf87} (propid: 0)

This is probably not the cause of this issue, but that propset looks suspiciously EAX-related. Besides being queried in between EAX2 and EAX3 listener queries, it's similar to DSPROPSETID_EAX30_ListenerProperties ({A8FA6880-B476-11d3-BDB9-00C0F02DDF87}) and DSPROPSETID_EAX30_BufferProperties ({A8FA6881-B476-11d3-BDB9-00C0F02DDF87}).

bibendovsky commented 1 year ago

The ranges mentioned in the error messages are correct. Decay LF Ratio (EAX3+): [0.1 .. 2.0] Environment Diffusion (EAX2+): [0 .. 1]

Creative's implementations (OpenAL and DirectSound) for Audigy Fx returns an error for values outside of the ranges. Though, EAX works in the game via Alchemy.

kcat commented 1 year ago

Creative's implementations (OpenAL and DirectSound) for Audigy Fx returns an error for values outside of the ranges.

Even when set through EAXREVERB_ALLPARAMETERS with just the diffusion value out of range? The reverb doesn't audibly change when returning an error that way, either? If so, this smells like the driver/ALchemy has an internal fix for the game, unless there's another reason the game is erroneously providing diffusion values up to 100.

I'm not too worried about the Decay LF Ratio error since it seems to only happen once at the start, and would get fixed up on subsequent environment changes.

bibendovsky commented 1 year ago

Creative's implementations (OpenAL and DirectSound) for Audigy Fx returns an error for values outside of the ranges.

Even when set through EAXREVERB_ALLPARAMETERS with just the diffusion value out of range? The reverb doesn't audibly change when returning an error that way, either? If so, this smells like the driver/ALchemy has an internal fix for the game, unless there's another reason the game is erroneously providing diffusion values up to 100.

Yes, I tried it with EAXREVERB_ALLPARAMETERS. And I'm not sure about the internal fix in the Alchemy - just placed it's dsound.dll along side with the game executable without any additional Alchemy tweaks.

kcat commented 1 year ago

And I'm not sure about the internal fix in the Alchemy - just placed it's dsound.dll along side with the game executable without any additional Alchemy tweaks.

I mean Alchemy or the hardware driver having a built-in workaround for this issue when it detects it's playing this game. It's not unusual for drivers to have workarounds for bugs in specific games, if the game's devs couldn't fix it on their end. This detection could be as simple as checking the executable name, or looking for other files in the same directory as the executable the game is expected to have, to matching the hash of some file(s) from the game. Then if it matches, change how it handles the diffusion parameter (ignoring it, clamping it, dividing it by 100, whatever). Or maybe there's something with that unknown propset that the game wants to use.

bibendovsky commented 1 year ago

And I'm not sure about the internal fix in the Alchemy - just placed it's dsound.dll along side with the game executable without any additional Alchemy tweaks.

I mean Alchemy or the hardware driver having a built-in workaround for this issue when it detects it's playing this game. It's not unusual for drivers to have workarounds for bugs in specific games, if the game's devs couldn't fix it on their end. This detection could be as simple as checking the executable name, or looking for other files in the same directory as the executable the game is expected to have, to matching the hash of some file(s) from the game. Then if it matches, change how it handles the diffusion parameter (ignoring it, clamping it, dividing it by 100, whatever). Or maybe there's something with that unknown propset that the game wants to use.

Yes, something like this was done in EAXEFX for Doom 3, Quake 4 and Prey. But I wrote about unsureness because I did only brief check on the problem. Anyway I'll try to investigate the issue.

bibendovsky commented 1 year ago

Quick test in Peyj's Workshop area shows the following:

kcat commented 1 year ago

Alchemy returns an error too in case of invalid value. So there is no built-in workaround. Why you hear the reverb in this case? I think it's default reverb and the sources in this area have audible "Room" parameter.

So there's possibly an issue with OpenAL Soft not having a generic reverb audible by default. The current behavior here is to initialize the default parameters for reverb on FXSlot0 and chorus on FXSlot1, but doesn't flag them as "dirty" so they don't get applied to EFX until an effect property changes (which avoids having reverb and chorus running when they're never used). This is normally fine since it's very unlikely that an app would use reverb without touching the effect parameters, but since this game is passing invalid parameters, it errors with no change to the effect, leaving the effect inactive until it successfully sets an effect parameter.

I'm not sure this is worth worrying about this since it seems reverb is only missing when loading directly into the area, whereas in ALchemy/hardware it's the generic preset. If another area's reverb is set, going to that area would keep the same reverb in both DSOAL and ALchemy/hardware.

bibendovsky commented 1 year ago

Made a patch to fix reverb parameters. Supports GOG and Ubisoft Connect versions. Unfortunately Steam version is protected.

UserGit-2021 commented 1 year ago

Made a patch to fix reverb parameters. Supports GOG and Ubisoft Connect versions. Unfortunately Steam version is protected.

https://youtu.be/TPoonnbTw8A dsoal_error.txt alsoft_error.txt

bibendovsky commented 1 year ago

Made a patch to fix reverb parameters. Supports GOG and Ubisoft Connect versions. Unfortunately Steam version is protected.

https://youtu.be/TPoonnbTw8A dsoal_error.txt alsoft_error.txt

2184:err:dsound:DSBuffer_Initialize Panning for multi-channel buffers is not supported
[ALSOFT] (EE) Context 0E6FFF60 current for thread being destroyed!

So, except the two errors unrelated to reverb it works fine?

UserGit-2021 commented 1 year ago

Made a patch to fix reverb parameters. Supports GOG and Ubisoft Connect versions. Unfortunately Steam version is protected.

https://youtu.be/TPoonnbTw8A dsoal_error.txt alsoft_error.txt

2184:err:dsound:DSBuffer_Initialize Panning for multi-channel buffers is not supported
[ALSOFT] (EE) Context 0E6FFF60 current for thread being destroyed!

So, except the two errors unrelated to reverb it works fine?

At the moment it's working fine. But I will have to complete the game with ALchemy and DSOAL. And I will send reports.