Integrate DSOAL and OpenAL Soft #287
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Intro
Integrate DSOAL and OpenAL Soft to enable 3D surround sound without special audio hardware. DSOAL uses OpenAL Soft to emulate DirectSound (DirectX Audio), including EAX.
Thanks to @ThreeDeeJay for the original idea.
Audio path
Before:
Now:
Modern WASAPI is now used as the audio backend instead of DirectSound, which is deprecated since Windows Vista.
The original
dsound.dll
(DirectSound) is not loaded at all anymore. This makes us less dependent on Windows-specific APIs, which brings us closer to making Crysis truly cross-platform. OpenAL Soft supports many platforms already.Configuration
It seems Crysis does not use EAX by default. Depending on sound quality settings,
s_ReverbType
cvar is either 0 (no reverb) or 2 (software reverb):The recommended config (
system.cfg
) from @ThreeDeeJay is the following:With this config, sound system logs the following during startup (
-verbosity 4
):EAX seems to be enabled and all looks good. However, this config makes in-game voices disappear completely and the following warning is constantly logged:
Tested on both Windows and Linux and with both DLL-based DSOAL and CryMP one (this PR). All combinations lead to the same results.
Moreover, we shouldn't depend on the externally provided
system.cfg
file. CryMP should configure the sound system appropriately on its own.OpenAL Soft also has its own optional
alsoft.ini
config file.Integration
DSOAL and OpenAL Soft are normally two DLLs (
dsound.dll
anddsoal-aldrv.dll
). We cannot use them because:This is why DSOAL and OpenAL Soft are integrated directly into the CryMP executable. DSOAL no longer loads the OpenAL Soft DLL and uses the one in the EXE instead.
Additional changes in DSOAL and OpenAL Soft source code were necessary to make them coexist in a single executable. For example, fixing collisions in global variables. Both also come with their own copy of fmtlib used for logging. For this reason, our DSOAL does not log anything currently.
Only source code of DSOAL and OpenAL Soft and their license files are added. Other unnecessary files from their repositories are omitted. Including their build system, which is reimplemented in our own
CMakeLists.txt
in a much simpler and cleaner way.TODO
-nodsoal
command line option to allow switching back the original DirectSound implementation without DSOAL and OpenAL Soft.Other than that, everything seems to work well already.