Skip to content

Commit 87d107b

Browse files
committed
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.
1 parent 758bccf commit 87d107b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

doc/classes/AudioStreamPlayer3D.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
<member name="unit_db" type="float" setter="set_unit_db" getter="get_unit_db" default="0.0">
109109
The base sound level unaffected by dampening, in decibels.
110110
</member>
111-
<member name="unit_size" type="float" setter="set_unit_size" getter="get_unit_size" default="1.0">
111+
<member name="unit_size" type="float" setter="set_unit_size" getter="get_unit_size" default="10.0">
112112
The factor for the attenuation effect. Higher values make the sound audible over a larger distance.
113113
</member>
114114
</members>

scene/3d/audio_stream_player_3d.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ void AudioStreamPlayer3D::_bind_methods() {
964964
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"), "set_stream", "get_stream");
965965
ADD_PROPERTY(PropertyInfo(Variant::INT, "attenuation_model", PROPERTY_HINT_ENUM, "Inverse,InverseSquare,Log,Disabled"), "set_attenuation_model", "get_attenuation_model");
966966
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "unit_db", PROPERTY_HINT_RANGE, "-80,80"), "set_unit_db", "get_unit_db");
967-
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "unit_size", PROPERTY_HINT_RANGE, "0.1,100,0.1"), "set_unit_size", "get_unit_size");
967+
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "unit_size", PROPERTY_HINT_RANGE, "0.1,100,0.01,or_greater"), "set_unit_size", "get_unit_size");
968968
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max_db", PROPERTY_HINT_RANGE, "-24,6"), "set_max_db", "get_max_db");
969969
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "pitch_scale", PROPERTY_HINT_RANGE, "0.01,4,0.01,or_greater"), "set_pitch_scale", "get_pitch_scale");
970970
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "is_playing");

scene/3d/audio_stream_player_3d.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class AudioStreamPlayer3D : public Node3D {
9898

9999
AttenuationModel attenuation_model = ATTENUATION_INVERSE_DISTANCE;
100100
float unit_db = 0.0;
101-
float unit_size = 1.0;
101+
float unit_size = 10.0;
102102
float max_db = 3.0;
103103
float pitch_scale = 1.0;
104104
bool autoplay = false;

0 commit comments

Comments
 (0)