summaryrefslogtreecommitdiff
path: root/scene/3d/audio_stream_player_3d.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-09-02 10:40:12 +0200
committerGitHub <noreply@github.com>2017-09-02 10:40:12 +0200
commit437fb12e1aa3135dc7fa336bd0a53036be649ce8 (patch)
treedf8288d031d4fdf06de7f8f717cb2eafd1c2854f /scene/3d/audio_stream_player_3d.cpp
parentded74dedefcb03fee1079d33f9688c2e401ea00e (diff)
parent9c63ab99f0a505b0f60079bb30cc453b4415fddc (diff)
Merge pull request #10877 from hpvb/fix-unitialized-variables
Fix use of unitialized variables
Diffstat (limited to 'scene/3d/audio_stream_player_3d.cpp')
-rw-r--r--scene/3d/audio_stream_player_3d.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 1ad36102ba..a69bec2fc8 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -183,7 +183,7 @@ void AudioStreamPlayer3D::_mix_audio() {
float AudioStreamPlayer3D::_get_attenuation_db(float p_distance) const {
- float att;
+ float att = 0;
switch (attenuation_model) {
case ATTENUATION_INVERSE_DISTANCE: {
att = Math::linear2db(1.0 / ((p_distance / unit_size) + 000001));
@@ -196,6 +196,10 @@ float AudioStreamPlayer3D::_get_attenuation_db(float p_distance) const {
case ATTENUATION_LOGARITHMIC: {
att = -20 * Math::log(p_distance / unit_size + 000001);
} break;
+ default: {
+ ERR_PRINT("Unknown attenuation type");
+ break;
+ }
}
att += unit_db;