[Audio] Fix pausing stream on entering tree

The paused notifications are only sent when pause status is changed,
this ensures that streams that are non-processing do not play when added
to the tree. Also ensures that the `process_mode` property applies
generally.

(cherry picked from commit 72fccd82c5)
This commit is contained in:
A Thousand Ships 2023-10-22 16:27:43 +02:00 committed by Yuri Sizov
parent 4c8ee43d08
commit 578fa8603d
3 changed files with 3 additions and 3 deletions

View File

@ -43,7 +43,7 @@ void AudioStreamPlayer2D::_notification(int p_what) {
if (autoplay && !Engine::get_singleton()->is_editor_hint()) { if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
play(); play();
} }
set_stream_paused(false); set_stream_paused(!can_process());
} break; } break;
case NOTIFICATION_EXIT_TREE: { case NOTIFICATION_EXIT_TREE: {

View File

@ -244,7 +244,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
if (autoplay && !Engine::get_singleton()->is_editor_hint()) { if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
play(); play();
} }
set_stream_paused(false); set_stream_paused(!can_process());
} break; } break;
case NOTIFICATION_EXIT_TREE: { case NOTIFICATION_EXIT_TREE: {

View File

@ -40,7 +40,7 @@ void AudioStreamPlayer::_notification(int p_what) {
if (autoplay && !Engine::get_singleton()->is_editor_hint()) { if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
play(); play();
} }
set_stream_paused(false); set_stream_paused(!can_process());
} break; } break;
case NOTIFICATION_INTERNAL_PROCESS: { case NOTIFICATION_INTERNAL_PROCESS: {