Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decrease default AudioStreamPlayer2D/3D panning strength #64077

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/config/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,10 +1203,10 @@ ProjectSettings::ProjectSettings() {

GLOBAL_DEF_BASIC("audio/buses/default_bus_layout", "res://default_bus_layout.tres");
custom_prop_info["audio/buses/default_bus_layout"] = PropertyInfo(Variant::STRING, "audio/buses/default_bus_layout", PROPERTY_HINT_FILE, "*.tres");
GLOBAL_DEF_RST("audio/general/2d_panning_strength", 1.0f);
custom_prop_info["audio/general/2d_panning_strength"] = PropertyInfo(Variant::FLOAT, "audio/general/2d_panning_strength", PROPERTY_HINT_RANGE, "0,4,0.01");
GLOBAL_DEF_RST("audio/general/3d_panning_strength", 1.0f);
custom_prop_info["audio/general/3d_panning_strength"] = PropertyInfo(Variant::FLOAT, "audio/general/3d_panning_strength", PROPERTY_HINT_RANGE, "0,4,0.01");
GLOBAL_DEF_RST("audio/general/2d_panning_strength", 0.5f);
custom_prop_info["audio/general/2d_panning_strength"] = PropertyInfo(Variant::FLOAT, "audio/general/2d_panning_strength", PROPERTY_HINT_RANGE, "0,2,0.01");
GLOBAL_DEF_RST("audio/general/3d_panning_strength", 0.5f);
custom_prop_info["audio/general/3d_panning_strength"] = PropertyInfo(Variant::FLOAT, "audio/general/3d_panning_strength", PROPERTY_HINT_RANGE, "0,2,0.01");

PackedStringArray extensions = PackedStringArray();
extensions.push_back("gd");
Expand Down
10 changes: 6 additions & 4 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,13 @@
<member name="audio/driver/output_latency.web" type="int" setter="" getter="" default="50">
Safer override for [member audio/driver/output_latency] in the Web platform, to avoid audio issues especially on mobile devices.
</member>
<member name="audio/general/2d_panning_strength" type="float" setter="" getter="" default="1.0">
The base strength of the panning effect for all AudioStreamPlayer2D nodes. The panning strength can be further scaled on each Node using [member AudioStreamPlayer2D.panning_strength].
<member name="audio/general/2d_panning_strength" type="float" setter="" getter="" default="0.5">
The base strength of the panning effect for all [AudioStreamPlayer2D] nodes. The panning strength can be further scaled on each Node using [member AudioStreamPlayer2D.panning_strength]. A value of [code]0.0[/code] disables stereo panning entirely, leaving only volume attenuation in place. A value of [code]1.0[/code] completely mutes one of the channels if the sound is located exactly to the left (or right) of the listener.
The default value of [code]0.5[/code] is tuned for headphones. When using speakers, you may find lower values to sound better as speakers have a lower stereo separation compared to headphones.
</member>
<member name="audio/general/3d_panning_strength" type="float" setter="" getter="" default="1.0">
The base strength of the panning effect for all AudioStreamPlayer3D nodes. The panning strength can be further scaled on each Node using [member AudioStreamPlayer3D.panning_strength].
<member name="audio/general/3d_panning_strength" type="float" setter="" getter="" default="0.5">
The base strength of the panning effect for all [AudioStreamPlayer3D] nodes. The panning strength can be further scaled on each Node using [member AudioStreamPlayer3D.panning_strength]. A value of [code]0.0[/code] disables stereo panning entirely, leaving only volume attenuation in place. A value of [code]1.0[/code] completely mutes one of the channels if the sound is located exactly to the left (or right) of the listener.
The default value of [code]0.5[/code] is tuned for headphones. When using speakers, you may find lower values to sound better as speakers have a lower stereo separation compared to headphones.
</member>
<member name="audio/video/video_delay_compensation_ms" type="int" setter="" getter="" default="0">
Setting to hardcode audio delay when playing video. Best to leave this untouched unless you know what you are doing.
Expand Down
2 changes: 1 addition & 1 deletion scene/2d/audio_stream_player_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class AudioStreamPlayer2D : public Node2D {
float attenuation = 1.0;

float panning_strength = 1.0f;
float cached_global_panning_strength = 1.0f;
float cached_global_panning_strength = 0.5f;

protected:
void _validate_property(PropertyInfo &property) const override;
Expand Down
2 changes: 1 addition & 1 deletion scene/3d/audio_stream_player_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class AudioStreamPlayer3D : public Node3D {
float _get_attenuation_db(float p_distance) const;

float panning_strength = 1.0f;
float cached_global_panning_strength = 1.0f;
float cached_global_panning_strength = 0.5f;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not seem like this is set anywhere?

Copy link
Member Author

@Calinou Calinou Aug 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's set here:

cached_global_panning_strength = ProjectSettings::get_singleton()->get("audio/general/3d_panning_strength");

Likewise in 2D:

cached_global_panning_strength = ProjectSettings::get_singleton()->get("audio/general/2d_panning_strength");

The value is set to the default in the header to avoid uninitialized data.


protected:
void _validate_property(PropertyInfo &property) const override;
Expand Down