From 87d107bb119d921babcd525577d27b518d4bc4f6 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 26 Apr 2020 14:26:01 +0200 Subject: [PATCH] Increase the default AudioStreamPlayer3D unit size to 10 This makes it easier to hear sound while setting up the node. Since this changes the default value, this may break existing projects slightly. This also tweaks the Unit Size editor property hint for better usability. See discussion in #25468. --- doc/classes/AudioStreamPlayer3D.xml | 2 +- scene/3d/audio_stream_player_3d.cpp | 2 +- scene/3d/audio_stream_player_3d.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml index db46ed27785..a1759bd5887 100644 --- a/doc/classes/AudioStreamPlayer3D.xml +++ b/doc/classes/AudioStreamPlayer3D.xml @@ -108,7 +108,7 @@ The base sound level unaffected by dampening, in decibels. - + The factor for the attenuation effect. Higher values make the sound audible over a larger distance. diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 72392be5bd2..2312e67f3bf 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -964,7 +964,7 @@ void AudioStreamPlayer3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"), "set_stream", "get_stream"); ADD_PROPERTY(PropertyInfo(Variant::INT, "attenuation_model", PROPERTY_HINT_ENUM, "Inverse,InverseSquare,Log,Disabled"), "set_attenuation_model", "get_attenuation_model"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "unit_db", PROPERTY_HINT_RANGE, "-80,80"), "set_unit_db", "get_unit_db"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "unit_size", PROPERTY_HINT_RANGE, "0.1,100,0.1"), "set_unit_size", "get_unit_size"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "unit_size", PROPERTY_HINT_RANGE, "0.1,100,0.01,or_greater"), "set_unit_size", "get_unit_size"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max_db", PROPERTY_HINT_RANGE, "-24,6"), "set_max_db", "get_max_db"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "pitch_scale", PROPERTY_HINT_RANGE, "0.01,4,0.01,or_greater"), "set_pitch_scale", "get_pitch_scale"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "is_playing"); diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h index 70c535bd890..8aec493602f 100644 --- a/scene/3d/audio_stream_player_3d.h +++ b/scene/3d/audio_stream_player_3d.h @@ -98,7 +98,7 @@ private: AttenuationModel attenuation_model = ATTENUATION_INVERSE_DISTANCE; float unit_db = 0.0; - float unit_size = 1.0; + float unit_size = 10.0; float max_db = 3.0; float pitch_scale = 1.0; bool autoplay = false;