summaryrefslogtreecommitdiff
path: root/scene/audio
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2019-04-27 12:17:54 -0300
committerGitHub <noreply@github.com>2019-04-27 12:17:54 -0300
commit60eec47077bfe14ffe3750c1e9827f2a731d4990 (patch)
tree5042078a95cb311bcced2f8a69fac8c8e9186478 /scene/audio
parent2931b4db5145d17da46caee1ccf4322939751707 (diff)
Revert "Fix AudioStreams::stop possibly causing a small noise"
Diffstat (limited to 'scene/audio')
-rw-r--r--scene/audio/audio_stream_player.cpp23
-rw-r--r--scene/audio/audio_stream_player.h3
2 files changed, 10 insertions, 16 deletions
diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp
index 47278b8fc1..865f672def 100644
--- a/scene/audio/audio_stream_player.cpp
+++ b/scene/audio/audio_stream_player.cpp
@@ -96,14 +96,10 @@ void AudioStreamPlayer::_mix_audio() {
return;
}
- if (stream_fade) {
- _mix_internal(true);
- stream_fade = false;
-
- if (stream_stop) {
- stream_playback->stop();
- active = false;
- set_process_internal(false);
+ if (stream_paused) {
+ if (stream_paused_fade) {
+ _mix_internal(true);
+ stream_paused_fade = false;
}
return;
}
@@ -209,7 +205,6 @@ void AudioStreamPlayer::play(float p_from_pos) {
if (stream_playback.is_valid()) {
//mix_volume_db = volume_db; do not reset volume ramp here, can cause clicks
- stream_stop = false;
setseek = p_from_pos;
active = true;
set_process_internal(true);
@@ -226,8 +221,9 @@ void AudioStreamPlayer::seek(float p_seconds) {
void AudioStreamPlayer::stop() {
if (stream_playback.is_valid()) {
- stream_stop = true;
- stream_fade = true;
+ stream_playback->stop();
+ active = false;
+ set_process_internal(false);
}
}
@@ -301,7 +297,7 @@ void AudioStreamPlayer::set_stream_paused(bool p_pause) {
if (p_pause != stream_paused) {
stream_paused = p_pause;
- stream_fade = p_pause ? true : false;
+ stream_paused_fade = p_pause ? true : false;
}
}
@@ -397,8 +393,7 @@ AudioStreamPlayer::AudioStreamPlayer() {
setseek = -1;
active = false;
stream_paused = false;
- stream_fade = false;
- stream_stop = false;
+ stream_paused_fade = false;
mix_target = MIX_TARGET_STEREO;
AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed");
diff --git a/scene/audio/audio_stream_player.h b/scene/audio/audio_stream_player.h
index 590bef95b0..12b74f8fda 100644
--- a/scene/audio/audio_stream_player.h
+++ b/scene/audio/audio_stream_player.h
@@ -58,8 +58,7 @@ private:
float volume_db;
bool autoplay;
bool stream_paused;
- bool stream_fade;
- bool stream_stop;
+ bool stream_paused_fade;
StringName bus;
MixTarget mix_target;