mirror of
https://github.com/godotengine/godot
synced 2024-09-05 21:39:38 +00:00
Fix AudioStreamPlayer not resuming after returning to SceneTree
This commit is contained in:
parent
48cfa0da70
commit
a7ce7b1d3f
|
@ -43,13 +43,18 @@ void AudioStreamPlayer2D::_notification(int p_what) {
|
|||
if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
|
||||
play();
|
||||
}
|
||||
set_stream_paused(false);
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
stop();
|
||||
set_stream_paused(true);
|
||||
AudioServer::get_singleton()->remove_listener_changed_callback(_listener_changed_cb, this);
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_PREDELETE: {
|
||||
stop();
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_PAUSED: {
|
||||
if (!can_process()) {
|
||||
// Node can't process so we start fading out to silence.
|
||||
|
|
|
@ -247,13 +247,18 @@ void AudioStreamPlayer3D::_notification(int p_what) {
|
|||
if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
|
||||
play();
|
||||
}
|
||||
set_stream_paused(false);
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
stop();
|
||||
set_stream_paused(true);
|
||||
AudioServer::get_singleton()->remove_listener_changed_callback(_listener_changed_cb, this);
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_PREDELETE: {
|
||||
stop();
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_PAUSED: {
|
||||
if (!can_process()) {
|
||||
// Node can't process so we start fading out to silence.
|
||||
|
|
|
@ -40,6 +40,7 @@ void AudioStreamPlayer::_notification(int p_what) {
|
|||
if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
|
||||
play();
|
||||
}
|
||||
set_stream_paused(false);
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||
|
@ -64,6 +65,10 @@ void AudioStreamPlayer::_notification(int p_what) {
|
|||
} break;
|
||||
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
set_stream_paused(true);
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_PREDELETE: {
|
||||
for (Ref<AudioStreamPlayback> &playback : stream_playbacks) {
|
||||
AudioServer::get_singleton()->stop_playback_stream(playback);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue