From 3d34803edca6fd8019d6ad3237f54ff793c7119e Mon Sep 17 00:00:00 2001 From: Ellen Poe Date: Sun, 14 Feb 2021 20:41:59 -0800 Subject: [PATCH] Return setseek position if one exists in get_playback_position. (cherry picked from commit 15b8480b2c76eecb5c9c31b88828345eed6224d6) --- scene/2d/audio_stream_player_2d.cpp | 3 +++ scene/3d/audio_stream_player_3d.cpp | 3 +++ scene/audio/audio_stream_player.cpp | 3 +++ 3 files changed, 9 insertions(+) diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index 1cd2745e02e..7dfc35ed958 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -358,6 +358,9 @@ bool AudioStreamPlayer2D::is_playing() const { float AudioStreamPlayer2D::get_playback_position() { if (stream_playback.is_valid()) { + if (setseek >= 0.0) { + return setseek; + } return stream_playback->get_playback_position(); } diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 184bef3c6dc..39f090d55ef 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -742,6 +742,9 @@ bool AudioStreamPlayer3D::is_playing() const { float AudioStreamPlayer3D::get_playback_position() { if (stream_playback.is_valid()) { + if (setseek >= 0.0) { + return setseek; + } return stream_playback->get_playback_position(); } diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp index a65e73be4b2..dce47ec82d8 100644 --- a/scene/audio/audio_stream_player.cpp +++ b/scene/audio/audio_stream_player.cpp @@ -281,6 +281,9 @@ bool AudioStreamPlayer::is_playing() const { float AudioStreamPlayer::get_playback_position() { if (stream_playback.is_valid()) { + if (setseek >= 0.0) { + return setseek; + } return stream_playback->get_playback_position(); }