diff --git a/doc/classes/AudioStreamPlayer2D.xml b/doc/classes/AudioStreamPlayer2D.xml index 76e8ee022c..0437a5c20b 100644 --- a/doc/classes/AudioStreamPlayer2D.xml +++ b/doc/classes/AudioStreamPlayer2D.xml @@ -53,7 +53,7 @@ - + Determines which [Area2D] layers affect the sound for reverb and audio bus effects. Areas can be used to redirect [AudioStream]s so that they play in a certain audio bus. An example of how you might use this is making a "water" area so that sounds played in the water are redirected through an audio bus to make them sound like they are being played underwater. diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml index 408c551068..68a5564f3c 100644 --- a/doc/classes/AudioStreamPlayer3D.xml +++ b/doc/classes/AudioStreamPlayer3D.xml @@ -53,7 +53,7 @@ - + Determines which [Area3D] layers affect the sound for reverb and audio bus effects. Areas can be used to redirect [AudioStream]s so that they play in a certain audio bus. An example of how you might use this is making a "water" area so that sounds played in the water are redirected through an audio bus to make them sound like they are being played underwater. diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index 429805f277..0e98231dd4 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -82,6 +82,10 @@ void AudioStreamPlayer2D::_notification(int p_what) { // Interacts with PhysicsServer2D, so can only be called during _physics_process. StringName AudioStreamPlayer2D::_get_actual_bus() { #ifndef PHYSICS_2D_DISABLED + if (area_mask == 0) { + return internal->bus; + } + Vector2 global_pos = get_global_position(); //check if any area is diverting sound into a bus diff --git a/scene/2d/audio_stream_player_2d.h b/scene/2d/audio_stream_player_2d.h index b3e996922a..c54e1b59eb 100644 --- a/scene/2d/audio_stream_player_2d.h +++ b/scene/2d/audio_stream_player_2d.h @@ -68,7 +68,7 @@ private: static void _listener_changed_cb(void *self) { reinterpret_cast(self)->force_update_panning = true; } - uint32_t area_mask = 1; + uint32_t area_mask = 0; float max_distance = 2000.0; float attenuation = 1.0; diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 0fcbe80d44..38a366f6e7 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -306,6 +306,10 @@ void AudioStreamPlayer3D::_notification(int p_what) { #ifndef PHYSICS_3D_DISABLED // Interacts with PhysicsServer3D, so can only be called during _physics_process Area3D *AudioStreamPlayer3D::_get_overriding_area() { + if (area_mask == 0) { + return nullptr; + } + //check if any area is diverting sound into a bus Ref world_3d = get_world_3d(); ERR_FAIL_COND_V(world_3d.is_null(), nullptr); diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h index 9dd97a7a93..13435ea4b0 100644 --- a/scene/3d/audio_stream_player_3d.h +++ b/scene/3d/audio_stream_player_3d.h @@ -100,7 +100,7 @@ private: #endif // PHYSICS_3D_DISABLED Vector _update_panning(); - uint32_t area_mask = 1; + uint32_t area_mask = 0; AudioServer::PlaybackType playback_type = AudioServer::PlaybackType::PLAYBACK_TYPE_DEFAULT;