Add stop_callable to AudioStreamPlayerInternal

(cherry picked from commit 8c7dd3cb61)
This commit is contained in:
Kusok
2024-08-11 20:27:15 +08:00
committed by Rémi Verschelde
parent 6b323241b1
commit 8ea64814ed
5 changed files with 16 additions and 14 deletions

View File

@ -242,7 +242,7 @@ void AudioStreamPlayer2D::seek(float p_seconds) {
void AudioStreamPlayer2D::stop() {
setplay.set(-1);
internal->stop();
internal->stop_basic();
}
bool AudioStreamPlayer2D::is_playing() const {
@ -430,7 +430,7 @@ void AudioStreamPlayer2D::_bind_methods() {
}
AudioStreamPlayer2D::AudioStreamPlayer2D() {
internal = memnew(AudioStreamPlayerInternal(this, callable_mp(this, &AudioStreamPlayer2D::play), true));
internal = memnew(AudioStreamPlayerInternal(this, callable_mp(this, &AudioStreamPlayer2D::play), callable_mp(this, &AudioStreamPlayer2D::stop), true));
cached_global_panning_strength = GLOBAL_GET("audio/general/2d_panning_strength");
set_hide_clip_children(true);
}