summaryrefslogtreecommitdiff
path: root/scene/audio
diff options
context:
space:
mode:
Diffstat (limited to 'scene/audio')
-rw-r--r--scene/audio/stream_player.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/scene/audio/stream_player.cpp b/scene/audio/stream_player.cpp
index 0ee9d76611..4cfca0492a 100644
--- a/scene/audio/stream_player.cpp
+++ b/scene/audio/stream_player.cpp
@@ -141,8 +141,8 @@ void StreamPlayer::play(float p_from_offset) {
ERR_FAIL_COND(!is_inside_tree());
if (playback.is_null())
return;
- if (playback->is_playing())
- stop();
+ //if (is_playing())
+ stop();
//_THREAD_SAFE_METHOD_
playback->play(p_from_offset);
@@ -165,6 +165,8 @@ void StreamPlayer::stop() {
//_THREAD_SAFE_METHOD_
AudioServer::get_singleton()->stream_set_active(stream_rid,false);
playback->stop();
+ resampler.flush();
+
//set_idle_process(false);
}
@@ -173,7 +175,7 @@ bool StreamPlayer::is_playing() const {
if (playback.is_null())
return false;
- return playback->is_playing();
+ return playback->is_playing() || resampler.has_data();
}
void StreamPlayer::set_loop(bool p_enable) {
@@ -265,7 +267,9 @@ void StreamPlayer::seek_pos(float p_time) {
if (playback.is_null())
return;
- return playback->seek_pos(p_time);
+ //works better...
+ stop();
+ playback->play(p_time);
}