halflife-unified-sdk
halflife-unified-sdk copied to clipboard
Implement software-based sound effects
The new sound system only provides EAX-based sound effects. Implementing software-based effects would allow the effects that most people are familiar with to be used.
This is tough to implement because the software effects are applied after sounds are mixed together.
OpenAL Soft provides an extension that could be useful here: https://openal-soft.org/openal-extensions/SOFT_loopback.txt
Creating 2 devices, one loopback device to mix sounds and another to play the sounds with software effects applied would work here.
As a side-effect this would also allow the EAX effects to be implemented as they are in the original engine, which funnels the mixed sounds to 4 3D audio sources with EAX effects enabled.
Note that loopback devices run on the same thread they are created on, as opposed to regular devices which run in a separate thread by default (see the ALC_SYNC
flag).
This means the sound system would have much more work to do on the main thread which could cause performance issues, especially when HRTF is enabled.
There may be other ways to implement this that don't require multiple devices but that requires further investigation.