From d3a482ab65da2ede63d1f72427962994784d7c12 Mon Sep 17 00:00:00 2001 From: Marcelo Fernandez Date: Tue, 10 Jul 2018 22:57:50 -0300 Subject: [PATCH] Fix possible bug with AudioStreamPlayer2D audio position (cherry picked from commit 0c78a58b6472f704d473e0307c9ea83dfbde1811) --- scene/2d/audio_stream_player_2d.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index 94db832e9fb..ef7b7d7512e 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -287,6 +287,11 @@ float AudioStreamPlayer2D::get_pitch_scale() const { void AudioStreamPlayer2D::play(float p_from_pos) { + if (!is_playing()) { + // Reset the prev_output_count if the stream is stopped + prev_output_count = 0; + } + if (stream_playback.is_valid()) { setplay = p_from_pos; output_ready = false;