mirror of
https://github.com/godotengine/godot.git
synced 2024-11-11 06:33:10 +00:00
Merge pull request #65983 from Mickeon/rename-audio-player-volume-db
Rename AudioStreamPlayer3D's `unit_db` to `volume_db`
This commit is contained in:
commit
2b376437a2
@ -7,7 +7,7 @@
|
||||
Plays a sound effect with directed sound effects, dampens with distance if needed, generates effect of hearable position in space. For greater realism, a low-pass filter is automatically applied to distant sounds. This can be disabled by setting [member attenuation_filter_cutoff_hz] to [code]20500[/code].
|
||||
By default, audio is heard from the camera position. This can be changed by adding an [AudioListener3D] node to the scene and enabling it by calling [method AudioListener3D.make_current] on it.
|
||||
See also [AudioStreamPlayer] to play a sound non-positionally.
|
||||
[b]Note:[/b] Hiding an [AudioStreamPlayer3D] node does not disable its audio output. To temporarily disable an [AudioStreamPlayer3D]'s audio output, set [member unit_db] to a very low value like [code]-100[/code] (which isn't audible to human hearing).
|
||||
[b]Note:[/b] Hiding an [AudioStreamPlayer3D] node does not disable its audio output. To temporarily disable an [AudioStreamPlayer3D]'s audio output, set [member volume_db] to a very low value like [code]-100[/code] (which isn't audible to human hearing).
|
||||
</description>
|
||||
<tutorials>
|
||||
<link title="Audio streams">$DOCS_URL/tutorials/audio/audio_streams.html</link>
|
||||
@ -102,12 +102,12 @@
|
||||
<member name="stream_paused" type="bool" setter="set_stream_paused" getter="get_stream_paused" default="false">
|
||||
If [code]true[/code], the playback is paused. You can resume it by setting [member stream_paused] to [code]false[/code].
|
||||
</member>
|
||||
<member name="unit_db" type="float" setter="set_unit_db" getter="get_unit_db" default="0.0">
|
||||
The base sound level unaffected by dampening, in decibels.
|
||||
</member>
|
||||
<member name="unit_size" type="float" setter="set_unit_size" getter="get_unit_size" default="10.0">
|
||||
The factor for the attenuation effect. Higher values make the sound audible over a larger distance.
|
||||
</member>
|
||||
<member name="volume_db" type="float" setter="set_volume_db" getter="get_volume_db" default="0.0">
|
||||
The base sound level unaffected by dampening, in decibels.
|
||||
</member>
|
||||
</members>
|
||||
<signals>
|
||||
<signal name="finished">
|
||||
|
@ -379,6 +379,7 @@ static const char *gdscript_function_renames[][2] = {
|
||||
{ "get_theme_item_types", "get_theme_item_type_list" }, // Theme
|
||||
{ "get_timer_process_mode", "get_timer_process_callback" }, // Timer
|
||||
{ "get_translation", "get_position" }, // Node3D broke GLTFNode which is used rarely
|
||||
{ "get_unit_db", "get_volume_db" }, // AudioStreamPlayer3D
|
||||
{ "get_unit_offset", "get_progress_ratio" }, // PathFollow2D, PathFollow3D
|
||||
{ "get_use_in_baked_light", "is_baking_navigation" }, // GridMap
|
||||
{ "get_used_cells_by_id", "get_used_cells" }, // TileMap
|
||||
@ -544,6 +545,7 @@ static const char *gdscript_function_renames[][2] = {
|
||||
{ "set_text_align", "set_text_alignment" }, // Button
|
||||
{ "set_timer_process_mode", "set_timer_process_callback" }, // Timer
|
||||
{ "set_translation", "set_position" }, // Node3D - this broke GLTFNode which is used rarely
|
||||
{ "set_unit_db", "set_volume_db" }, // AudioStreamPlayer3D
|
||||
{ "set_unit_offset", "set_progress_ratio" }, // PathFollow2D, PathFollow3D
|
||||
{ "set_uv2", "surface_set_uv2" }, // ImmediateMesh broke Surffacetool
|
||||
{ "set_v_drag_enabled", "set_drag_vertical_enabled" }, // Camera2D
|
||||
@ -812,6 +814,7 @@ static const char *csharp_function_renames[][2] = {
|
||||
{ "GetThemeItemTypes", "GetThemeItemTypeList" }, // Theme
|
||||
{ "GetTimerProcessMode", "GetTimerProcessCallback" }, // Timer
|
||||
{ "GetTranslation", "GetPosition" }, // Node3D broke GLTFNode which is used rarely
|
||||
{ "GetUnitDb", "GetVolumeDb" }, // AudioStreamPlayer3D
|
||||
{ "GetUnitOffset", "GetProgressRatio" }, // PathFollow2D, PathFollow3D
|
||||
{ "GetUseInBakedLight", "IsBakingNavigation" }, // GridMap
|
||||
{ "GetUsedCellsById", "GetUsedCells" }, // TileMap
|
||||
@ -969,6 +972,7 @@ static const char *csharp_function_renames[][2] = {
|
||||
{ "SetTimerProcessMode", "SetTimerProcessCallback" }, // Timer
|
||||
{ "SetTonemapAutoExposure", "SetTonemapAutoExposureEnabled" }, // Environment
|
||||
{ "SetTranslation", "SetPosition" }, // Node3D - this broke GLTFNode which is used rarely
|
||||
{ "SetUnitDb", "SetVolumeDb" }, // AudioStreamPlayer3D
|
||||
{ "SetUnitOffset", "SetProgressRatio" }, // PathFollow2D, PathFollow3D
|
||||
{ "SetUv2", "SurfaceSetUv2" }, // ImmediateMesh broke Surffacetool
|
||||
{ "SetVDragEnabled", "SetDragVerticalEnabled" }, // Camera2D
|
||||
@ -1133,6 +1137,7 @@ static const char *gdscript_properties_renames[][2] = {
|
||||
{ "table_hseparation", "table_h_separation" }, // Theme
|
||||
{ "table_vseparation", "table_v_separation" }, // Theme
|
||||
{ "translation", "position" }, // Node3D - broke GLTFNode
|
||||
{ "unit_db", "volume_db" }, // AudioStreamPlayer3D
|
||||
{ "unit_offset", "progress_ratio" }, // PathFollow2D, PathFollow3D
|
||||
{ "vseparation", "v_separation" }, // Theme
|
||||
|
||||
@ -1223,6 +1228,7 @@ static const char *csharp_properties_renames[][2] = {
|
||||
{ "TableHseparation", "TableHSeparation" }, // Theme
|
||||
{ "TableVseparation", "TableVSeparation" }, // Theme
|
||||
{ "Translation", "Position" }, // Node3D - broke GLTFNode
|
||||
{ "UnitDb", "VolumeDb" }, // AudioStreamPlayer3D
|
||||
{ "UnitOffset", "ProgressRatio" }, // PathFollow2D, PathFollow3D
|
||||
{ "Vseparation", "VSeparation" }, // Theme
|
||||
|
||||
|
@ -231,7 +231,7 @@ float AudioStreamPlayer3D::_get_attenuation_db(float p_distance) const {
|
||||
}
|
||||
}
|
||||
|
||||
att += unit_db;
|
||||
att += volume_db;
|
||||
if (att > max_db) {
|
||||
att = max_db;
|
||||
}
|
||||
@ -538,12 +538,12 @@ Ref<AudioStream> AudioStreamPlayer3D::get_stream() const {
|
||||
return stream;
|
||||
}
|
||||
|
||||
void AudioStreamPlayer3D::set_unit_db(float p_volume) {
|
||||
unit_db = p_volume;
|
||||
void AudioStreamPlayer3D::set_volume_db(float p_volume) {
|
||||
volume_db = p_volume;
|
||||
}
|
||||
|
||||
float AudioStreamPlayer3D::get_unit_db() const {
|
||||
return unit_db;
|
||||
float AudioStreamPlayer3D::get_volume_db() const {
|
||||
return volume_db;
|
||||
}
|
||||
|
||||
void AudioStreamPlayer3D::set_unit_size(float p_volume) {
|
||||
@ -810,8 +810,8 @@ void AudioStreamPlayer3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_stream", "stream"), &AudioStreamPlayer3D::set_stream);
|
||||
ClassDB::bind_method(D_METHOD("get_stream"), &AudioStreamPlayer3D::get_stream);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_unit_db", "unit_db"), &AudioStreamPlayer3D::set_unit_db);
|
||||
ClassDB::bind_method(D_METHOD("get_unit_db"), &AudioStreamPlayer3D::get_unit_db);
|
||||
ClassDB::bind_method(D_METHOD("set_volume_db", "volume_db"), &AudioStreamPlayer3D::set_volume_db);
|
||||
ClassDB::bind_method(D_METHOD("get_volume_db"), &AudioStreamPlayer3D::get_volume_db);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_unit_size", "unit_size"), &AudioStreamPlayer3D::set_unit_size);
|
||||
ClassDB::bind_method(D_METHOD("get_unit_size"), &AudioStreamPlayer3D::get_unit_size);
|
||||
@ -878,7 +878,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,Inverse Square,Logarithmic,Disabled"), "set_attenuation_model", "get_attenuation_model");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "unit_db", PROPERTY_HINT_RANGE, "-80,80,suffix:dB"), "set_unit_db", "get_unit_db");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "volume_db", PROPERTY_HINT_RANGE, "-80,80,suffix:dB"), "set_volume_db", "get_volume_db");
|
||||
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,suffix:dB"), "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");
|
||||
|
@ -71,7 +71,7 @@ private:
|
||||
SafeNumeric<float> setplay{ -1.0 };
|
||||
|
||||
AttenuationModel attenuation_model = ATTENUATION_INVERSE_DISTANCE;
|
||||
float unit_db = 0.0;
|
||||
float volume_db = 0.0;
|
||||
float unit_size = 10.0;
|
||||
float max_db = 3.0;
|
||||
float pitch_scale = 1.0;
|
||||
@ -128,8 +128,8 @@ public:
|
||||
void set_stream(Ref<AudioStream> p_stream);
|
||||
Ref<AudioStream> get_stream() const;
|
||||
|
||||
void set_unit_db(float p_volume);
|
||||
float get_unit_db() const;
|
||||
void set_volume_db(float p_volume);
|
||||
float get_volume_db() const;
|
||||
|
||||
void set_unit_size(float p_volume);
|
||||
float get_unit_size() const;
|
||||
|
@ -1565,11 +1565,7 @@ void AnimationTree::_process_graph(double p_delta) {
|
||||
}
|
||||
|
||||
real_t db = Math::linear_to_db(MAX(blend, 0.00001));
|
||||
if (t->object->has_method(SNAME("set_unit_db"))) {
|
||||
t->object->call(SNAME("set_unit_db"), db);
|
||||
} else {
|
||||
t->object->call(SNAME("set_volume_db"), db);
|
||||
}
|
||||
t->object->call(SNAME("set_volume_db"), db);
|
||||
} break;
|
||||
case Animation::TYPE_ANIMATION: {
|
||||
if (blend < CMP_EPSILON) {
|
||||
|
Loading…
Reference in New Issue
Block a user