Add DopplerFactor to Audio Source

This commit is contained in:
Wojtek Figat
2023-04-20 16:01:27 +02:00
parent c8dc8396f9
commit eb613d3e8a
4 changed files with 37 additions and 4 deletions

View File

@@ -47,7 +47,8 @@ private:
float _volume;
float _pitch;
float _minDistance;
float _attenuation;
float _attenuation = 1.0f;
float _dopplerFactor = 1.0f;
bool _loop;
bool _playOnStart;
bool _allowSpatialization;
@@ -164,6 +165,20 @@ public:
/// </summary>
API_PROPERTY() void SetAttenuation(float value);
/// <summary>
/// Gets the doppler effect factor. Scale for source velocity. Default is 1.
/// </summary>
API_PROPERTY(Attributes="EditorOrder(75), DefaultValue(1.0f), Limit(0, float.MaxValue, 0.1f), EditorDisplay(\"Audio Source\")")
FORCE_INLINE float GetDopplerFactor() const
{
return _dopplerFactor;
}
/// <summary>
/// Sets the doppler effect factor. Scale for source velocity. Default is 1.
/// </summary>
API_PROPERTY() void SetDopplerFactor(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>