Add OpenAL AL_SOFT_source_spatialize extension support for stereo spatial audio playback

Add `AllowSpatialization` option to `AudioSource`
This commit is contained in:
Wojtek Figat
2023-04-20 15:01:22 +02:00
parent 094a3cfe5a
commit 1ffe8a7b60
16 changed files with 183 additions and 130 deletions

View File

@@ -50,6 +50,7 @@ private:
float _attenuation;
bool _loop;
bool _playOnStart;
bool _allowSpatialization;
bool _isActuallyPlayingSth = false;
bool _needToUpdateStreamingBuffers = false;
@@ -163,6 +164,20 @@ public:
/// </summary>
API_PROPERTY() void SetAttenuation(float value);
/// <summary>
/// If checked, source can play spatial 3d audio (when audio clip supports it), otherwise will always play as 2d sound. At 0, no distance attenuation ever occurs.
/// </summary>
API_PROPERTY(Attributes="EditorOrder(80), DefaultValue(true), EditorDisplay(\"Audio Source\")")
FORCE_INLINE bool GetAllowSpatialization() const
{
return _allowSpatialization;
}
/// <summary>
/// If checked, source can play spatial 3d audio (when audio clip supports it), otherwise will always play as 2d sound.
/// </summary>
API_PROPERTY() void SetAllowSpatialization(bool value);
public:
/// <summary>
/// Starts playing the currently assigned audio clip.