summaryrefslogtreecommitdiffstats
path: root/scene/audio/audio_stream_player_internal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/audio/audio_stream_player_internal.cpp')
-rw-r--r--scene/audio/audio_stream_player_internal.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/scene/audio/audio_stream_player_internal.cpp b/scene/audio/audio_stream_player_internal.cpp
index 36c14e03d5..206408e3a7 100644
--- a/scene/audio/audio_stream_player_internal.cpp
+++ b/scene/audio/audio_stream_player_internal.cpp
@@ -132,7 +132,7 @@ Ref<AudioStreamPlayback> AudioStreamPlayerInternal::play_basic() {
}
ERR_FAIL_COND_V_MSG(!node->is_inside_tree(), stream_playback, "Playback can only happen when a node is inside the scene tree");
if (stream->is_monophonic() && is_playing()) {
- stop();
+ stop_callable.call();
}
stream_playback = stream->instantiate_playback();
ERR_FAIL_COND_V_MSG(stream_playback.is_null(), stream_playback, "Failed to instantiate playback.");
@@ -242,7 +242,7 @@ void AudioStreamPlayerInternal::set_stream(Ref<AudioStream> p_stream) {
if (stream.is_valid()) {
stream->disconnect(SNAME("parameter_list_changed"), callable_mp(this, &AudioStreamPlayerInternal::_update_stream_parameters));
}
- stop();
+ stop_callable.call();
stream = p_stream;
_update_stream_parameters();
if (stream.is_valid()) {
@@ -253,12 +253,12 @@ void AudioStreamPlayerInternal::set_stream(Ref<AudioStream> p_stream) {
void AudioStreamPlayerInternal::seek(float p_seconds) {
if (is_playing()) {
- stop();
+ stop_callable.call();
play_callable.call(p_seconds);
}
}
-void AudioStreamPlayerInternal::stop() {
+void AudioStreamPlayerInternal::stop_basic() {
for (Ref<AudioStreamPlayback> &playback : stream_playbacks) {
AudioServer::get_singleton()->stop_playback_stream(playback);
}
@@ -289,7 +289,7 @@ void AudioStreamPlayerInternal::set_playing(bool p_enable) {
if (p_enable) {
play_callable.call(0.0);
} else {
- stop();
+ stop_callable.call();
}
}
@@ -339,9 +339,10 @@ StringName AudioStreamPlayerInternal::get_bus() const {
return SceneStringName(Master);
}
-AudioStreamPlayerInternal::AudioStreamPlayerInternal(Node *p_node, const Callable &p_play_callable, bool p_physical) {
+AudioStreamPlayerInternal::AudioStreamPlayerInternal(Node *p_node, const Callable &p_play_callable, const Callable &p_stop_callable, bool p_physical) {
node = p_node;
play_callable = p_play_callable;
+ stop_callable = p_stop_callable;
physical = p_physical;
bus = SceneStringName(Master);