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

Implement environmental audio using OpenAL EFX #3182

Draft
wants to merge 97 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
86b6063
:wrench: Add missing namespace
Hiradur Sep 22, 2024
911bb58
:wrench: Add missing constructor
Hiradur Sep 22, 2024
0f43737
:bug: Update/fix Doppler effect for OpenAL 1.1 implementations
Hiradur Sep 23, 2024
3aac9eb
:wrench: rename setCamera methods of audio related classes to setList…
Hiradur Sep 24, 2024
aa54fbd
:wrench: Refactor SoundScriptManager::update method
Hiradur Sep 24, 2024
a4e2fc2
:sparkles: Add ConsoleCmd to get current speed of sound
Hiradur Sep 24, 2024
1ac28ad
:sparkles: Set speed of sound dependent of the medium the listener is in
Hiradur Sep 24, 2024
2de6ca1
:wrench: Adjust formatting for upcoming new function call
Hiradur Sep 24, 2024
2a1a2fa
:sparkles: Make doppler factor configurable and scriptable
Hiradur Sep 24, 2024
5a219c5
:wrench: Rename camera_position to listener_position where appropriate
Hiradur Sep 25, 2024
e51e848
:wrench: Refactor how the speed of sound is set
Hiradur Sep 25, 2024
c010e3c
Merge branch 'fix/gcc_build' into feat/openal_efx
Hiradur Sep 25, 2024
e061fe0
:sparkles: Add preliminary support for reverb using OpenAL EFX
Hiradur Sep 25, 2024
f7617a3
:bug: Replace redundant efx preset with the intended one
Hiradur Sep 25, 2024
fbd1d87
:wrench: Rename updateListenerEnvironment to updateListenerEffectSlot…
Hiradur Sep 26, 2024
63e3e24
:triangular_ruler: Add whitespaces for upcoming CVars
Hiradur Sep 26, 2024
ce210cc
:wrench: Only create OpenAL effects when not already existing
Hiradur Sep 26, 2024
7569d9f
:construction: Simulate absorption of sound at high frequencies
Hiradur Sep 26, 2024
b65c3ea
:construction: Simulate obstruction of sound emitters
Hiradur Sep 26, 2024
4294393
:sparkles: Add support for the AL_EFFECT_EAXREVERB reverb engine
Hiradur Sep 26, 2024
c9cddb4
:video_game: Add EFX_REVERB_PRESET_PREFAB_CARAVAN preset
Hiradur Sep 27, 2024
271a54a
:triangular_ruler: Remove leftover function declaration that was move…
Hiradur Sep 27, 2024
3caa796
:triangular_ruler: Rename build_efx_property_map() to prepopulate_efx…
Hiradur Sep 27, 2024
75b643d
:triangular_ruler: Reformat audio CVars for upcoming CVar
Hiradur Sep 27, 2024
4614579
:sparkles: Allow to disable engine-controlled environmental audio
Hiradur Sep 27, 2024
b300197
:wrench: Always update the listener effect
Hiradur Sep 27, 2024
7adf434
:construction: Implement basic reflection panning
Hiradur Sep 27, 2024
c079bc8
:bug: Fix calculation of magnitude
Hiradur Sep 28, 2024
2d39eff
:books: Describe how we tranform the reflections panning vector
Hiradur Sep 28, 2024
98b5765
:sparkles: Boost early reflections if a nearby surface is detected
Hiradur Sep 28, 2024
4e23e34
:triangular_ruler: Minor optimizations
Hiradur Sep 28, 2024
380a5fd
:sparkles: Add options for obstruction and reflection panning to sett…
Hiradur Sep 28, 2024
52dd97c
:sparkles: Make OpenAL EFX reverb engine selectable in settings menu
Hiradur Sep 28, 2024
9d1ba29
:bug: Fix calculation of magnitude for the case where there are surfa…
Hiradur Sep 28, 2024
6904fda
:bug: Improve the collision detection for the obstruction filter
Hiradur Sep 28, 2024
60f196f
:sparkles: Add options to settings menu for overriding environmental …
Hiradur Sep 29, 2024
5005f5a
:wrench: Add get function for efx properties map
Hiradur Sep 29, 2024
8fc9ad1
:wrench: Add function to check whether a ray intersects with the terrain
Hiradur Sep 29, 2024
7d8e106
:sparkles: Also apply the obstruction filter if a sound is obstructed…
Hiradur Sep 29, 2024
ca13850
:wrench: Add get function for listener position
Hiradur Sep 29, 2024
c31e21b
:sparkles: Apply incar reverb preset if the listener is inside an actor
Hiradur Sep 29, 2024
b516f76
:wrench: Create helper function for determining if the listener is un…
Hiradur Sep 29, 2024
2ad39b5
:wrench: Create helper function for checking if the listener is insid…
Hiradur Sep 29, 2024
42afaee
:construction: Also apply the obstruction filter if the listener is i…
Hiradur Sep 29, 2024
795f20e
:wrench: Move obstruction filter code to its own function
Hiradur Sep 30, 2024
05dd2f5
:books: Add a comment describing the obstruction checks
Hiradur Sep 30, 2024
8025c52
:wrench: Only iterate over hardware source in use
Hiradur Oct 1, 2024
82b19c7
:sparkles: Also apply the obstruction filter if a sound is obstructed…
Hiradur Oct 1, 2024
2df5cdc
:wrench: Add settings for setting a default reverb preset and a force…
Hiradur Oct 1, 2024
68895d9
:wrench: Minor refactoring of the obstruction filter code
Hiradur Oct 2, 2024
90ec4e5
:books: Add documentation for several functions
Hiradur Oct 3, 2024
3b7c291
:wrench: Split the setListener function into several functions
Hiradur Oct 3, 2024
d762a6c
:wrench: Move the source filtering code to the update() function
Hiradur Oct 3, 2024
1bff42d
:sparkles: Also apply the obstruction filter if a sound is obstructed…
Hiradur Oct 3, 2024
6d27bb2
:wrench: Add Get function for CELL_SIZE
Hiradur Oct 5, 2024
dc32577
:construction: Improve algorithm for early reflections panning
Hiradur Oct 5, 2024
5bd3418
:bugfix: Fix calculation of magnitude
Hiradur Oct 5, 2024
44a04af
:construction: Implement smooth updates of early reflections properties
Hiradur Oct 5, 2024
46f1160
:triangular_ruler: Add const qualifier at several places
Hiradur Oct 6, 2024
7532b23
:triangular_ruler: Use const reference instead of pointer
Hiradur Oct 6, 2024
8bc2c5f
:bug: Fix overshooting on smooth early reflections properties updates…
Hiradur Oct 18, 2024
3f45dc1
:wrench: Optimize passing around EFX reverb properties
Hiradur Oct 18, 2024
06c22e4
:triangular_ruler: Adapt to coding style guidelines
Hiradur Oct 18, 2024
c441dc0
:video_game: Disable obstruction filter for sources when the feature …
Hiradur Oct 19, 2024
926c216
:bug: Get error messages from OpenAL instead of integers/enum values
Hiradur Oct 19, 2024
ae6a3fa
:books: Update documentation of variables
Hiradur Oct 19, 2024
6a9866b
:bug: Track audio sources and buffers separately
Hiradur Oct 19, 2024
ba80d76
:bug: Fix obstruction filter not getting updated in all cases
Hiradur Oct 19, 2024
ae24b34
:bug: Update obstruction filter before playing a source to avoid pop-ins
Hiradur Oct 19, 2024
9d022cb
:video_game: Add option to force efx preset to top menu
Hiradur Oct 19, 2024
22af2aa
:video_game: Add a few more EFX presets
Hiradur Oct 19, 2024
d9ac309
:triangular_ruler: Prettify alignment of assignments
Hiradur Oct 19, 2024
343e342
:video_game: Add a few more efx reverb presets
Hiradur Oct 19, 2024
9291a23
:sparkles: Add option to boxes for defining reverb presets
Hiradur Oct 20, 2024
1ad8791
:video_game: Define reverb presets for some of the prefab models
Hiradur Oct 20, 2024
39cab9a
:wrench: Only return listener-relevant presets if the the listener is…
Hiradur Oct 20, 2024
9b908a3
:wrench: Return water reverb preset for any position below water leve…
Hiradur Oct 20, 2024
29fbaea
:video_game: Do not return a reverb preset if the listener inside a t…
Hiradur Oct 20, 2024
b049531
:video_game: Also consider nearby collision boxes and actors for refl…
Hiradur Oct 20, 2024
e40982f
:video_game: Add reverb presets to office rooms of prefabs
Hiradur Oct 20, 2024
8db0f73
:video_game: Smoothly change reverb properties
Hiradur Oct 23, 2024
9df9e86
:triangular_ruler: Align parameters
Hiradur Nov 2, 2024
3b8c016
:video_game: Make reverb preset transitions smoother
Hiradur Nov 2, 2024
2dbc482
:video_game: Rework frequency-dependent absorption for sound
Hiradur Nov 2, 2024
135303f
:video_game: no longer apply the obstruction filter if the listener i…
Hiradur Nov 24, 2024
f9e26fc
:video_game: Remove dopplerfactor console command
Hiradur Nov 24, 2024
39108ec
:triangular_ruler: Add space between if and opening bracket
Hiradur Nov 30, 2024
e191dff
:wrench: Move ListenerIsUnderwater method from SoundScriptManager to …
Hiradur Nov 30, 2024
bb9cb7c
:wrench: Move GetReverbPresetAt method from SoundScriptManager to Sou…
Hiradur Nov 30, 2024
db43be9
:wrench: Move SetListenerEnvironment method from SoundScriptManager t…
Hiradur Nov 30, 2024
bc5977a
:triangular_ruler: No longer declare sound obstruction as experimental
Hiradur Dec 1, 2024
f098080
:bug: Ensure that limits of reverb parameters are not exceeded if tim…
Hiradur Dec 11, 2024
02ca127
:triangular_ruler: Add missing this-> to follow coding style guidelines
Hiradur Dec 11, 2024
4393bb9
:wrench: Express the distance to the intersection in the ray's direct…
Hiradur Dec 14, 2024
cd2b1ef
:wrench: Eliminate an unnecessary vector normalisation
Hiradur Dec 14, 2024
d25d63c
:video_game: Rename audio_default_listener_efx_preset to audio_defaul…
Hiradur Dec 14, 2024
9930506
:sparkles: Implement environmental occlusion of sounds
Hiradur Dec 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions resources/meshes/ferryslip.odef
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@ ferryslip.mesh
beginmesh
mesh ferryslipcol.mesh
endmesh

beginbox
boxcoords -8.1, 8.2, 6.9, 9.5, -4.7, -2.3
virtual
reverb_preset EFX_REVERB_PRESET_WOODEN_SHORTPASSAGE
endbox

end
2 changes: 2 additions & 0 deletions resources/meshes/hangar.odef
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ beginbox
boxcoords -23.75, -21.75, -0.2, 2.1, -3.07, -0.19
virtual
event shopplane avatar
reverb_preset EFX_REVERB_PRESET_WOODEN_ALCOVE
endbox

beginbox
boxcoords -17, 17, 0, 4.5, -29, 4
virtual
event spawnzone
reverb_preset EFX_REVERB_PRESET_FACTORY_HALL
direction 0, 90, 0
endbox

Expand Down
1 change: 1 addition & 0 deletions resources/meshes/marina.odef
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ endmesh
beginbox
boxcoords -25, -17, 0, 3, -11, 11
virtual
reverb_preset EFX_REVERB_PRESET_WOODEN_MEDIUMROOM
event shopboat avatar
endbox

Expand Down
2 changes: 2 additions & 0 deletions resources/meshes/myhangar2.odef
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ endbox
beginbox
boxcoords -11.5, -2.1, -0.5, 3.0, -9.70, -7.5
virtual
reverb_preset EFX_REVERB_PRESET_ROOM
event repair avatar
endbox

beginbox
boxcoords -12.0, 12.0, -0.5, 5.5, -7.0, 7.0
virtual
reverb_preset EFX_REVERB_PRESET_FACTORY_SMALLROOM
forcecamera 11.35, 5.06, 6.41
endbox

Expand Down
2 changes: 2 additions & 0 deletions resources/meshes/truckshop.odef
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ beginbox
boxcoords -11.5, -2.1, -0.5, 3.0, -9.70, -7.5
virtual
event shoptruck avatar
reverb_preset EFX_REVERB_PRESET_WOODEN_ALCOVE
endbox

beginbox
boxcoords -12.0, 12.0, -0.5, 5.5, -7.0, 7.0
virtual
reverb_preset EFX_REVERB_PRESET_FACTORY_LARGEROOM
forcecamera 11.35, 5.06, 6.41
endbox

Expand Down
20 changes: 20 additions & 0 deletions source/main/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,16 @@ CVar* io_invert_orbitcam;
// Audio
CVar* audio_master_volume;
CVar* audio_enable_creak;
CVar* audio_enable_obstruction;
CVar* audio_enable_occlusion;
CVar* audio_enable_reflection_panning;
CVar* audio_enable_efx;
CVar* audio_engine_controls_environmental_audio;
CVar* audio_efx_reverb_engine;
CVar* audio_default_efx_preset;
CVar* audio_force_listener_efx_preset;
CVar* audio_device_name;
CVar* audio_doppler_factor;
CVar* audio_menu_music;

// Graphics
Expand Down Expand Up @@ -544,6 +553,17 @@ std::string ToLocalizedString(IoInputGrabMode e)
}
}

std::string ToLocalizedString(EfxReverbEngine e)
{
switch (e)
{
case EfxReverbEngine::NONE: return _LC("EfxReverbEngine", "None (no reverb, fastest)");
case EfxReverbEngine::REVERB: return _LC("EfxReverbEngine", "REVERB");
case EfxReverbEngine::EAXREVERB: return _LC("EfxReverbEngine", "EAXREVERB (more realistic effects, slower)");
default: return "";
}
}

std::string ToLocalizedString(SimResetMode e)
{
switch (e)
Expand Down
17 changes: 17 additions & 0 deletions source/main/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,14 @@ enum class GfxSkyMode
};
std::string ToLocalizedString(GfxSkyMode e);

enum class EfxReverbEngine
{
NONE,
REVERB,
EAXREVERB,
};
std::string ToLocalizedString(EfxReverbEngine e);

enum class IoInputGrabMode
{
NONE,
Expand Down Expand Up @@ -445,7 +453,16 @@ extern CVar* io_invert_orbitcam;
// Audio
extern CVar* audio_master_volume;
extern CVar* audio_enable_creak;
extern CVar* audio_enable_obstruction;
extern CVar* audio_enable_occlusion;
extern CVar* audio_enable_reflection_panning;
extern CVar* audio_enable_efx;
extern CVar* audio_engine_controls_environmental_audio;
extern CVar* audio_efx_reverb_engine;
extern CVar* audio_default_efx_preset;
extern CVar* audio_force_listener_efx_preset;
extern CVar* audio_device_name;
extern CVar* audio_doppler_factor;
extern CVar* audio_menu_music;

// Graphics
Expand Down
Loading
Loading