Skip to content

Commit

Permalink
Fix AudioStreamPlayer2D/3D's get_playback_position returning 0 ri…
Browse files Browse the repository at this point in the history
…ght after calling `seek`
  • Loading branch information
Mickeon committed Nov 27, 2024
1 parent bbc5469 commit 99cbcd2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scene/2d/audio_stream_player_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ bool AudioStreamPlayer2D::is_playing() const {
}

float AudioStreamPlayer2D::get_playback_position() {
if (setplay.get() >= 0) {
return setplay.get(); // play() has been called this frame, but no playback exists just yet.
}
return internal->get_playback_position();
}

Expand Down
3 changes: 3 additions & 0 deletions scene/3d/audio_stream_player_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,9 @@ bool AudioStreamPlayer3D::is_playing() const {
}

float AudioStreamPlayer3D::get_playback_position() {
if (setplay.get() >= 0) {
return setplay.get(); // play() has been called this frame, but no playback exists just yet.
}
return internal->get_playback_position();
}

Expand Down

0 comments on commit 99cbcd2

Please sign in to comment.