Skip to content

Commit

Permalink
[Audio] Fix pausing stream on entering tree
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AThousandShips committed Oct 22, 2023
1 parent 8c25a98 commit 72fccd8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scene/2d/audio_stream_player_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void AudioStreamPlayer2D::_notification(int p_what) {
if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
play();
}
set_stream_paused(false);
set_stream_paused(!can_process());
} break;

case NOTIFICATION_EXIT_TREE: {
Expand Down
2 changes: 1 addition & 1 deletion scene/3d/audio_stream_player_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
play();
}
set_stream_paused(false);
set_stream_paused(!can_process());
} break;

case NOTIFICATION_EXIT_TREE: {
Expand Down
2 changes: 1 addition & 1 deletion scene/audio/audio_stream_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void AudioStreamPlayer::_notification(int p_what) {
if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
play();
}
set_stream_paused(false);
set_stream_paused(!can_process());
} break;

case NOTIFICATION_INTERNAL_PROCESS: {
Expand Down

0 comments on commit 72fccd8

Please sign in to comment.