From 2edf9b95b3457701439b0a7ffd2493aaf1fa7c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 9 Aug 2024 10:57:45 +0200 Subject: [PATCH] AudioStreamPolyphonic: Implement stopping with sample playback Fixes #94724. --- scene/resources/audio_stream_polyphonic.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scene/resources/audio_stream_polyphonic.cpp b/scene/resources/audio_stream_polyphonic.cpp index e617096f3b5e..999b0c9f0a56 100644 --- a/scene/resources/audio_stream_polyphonic.cpp +++ b/scene/resources/audio_stream_polyphonic.cpp @@ -143,6 +143,10 @@ int AudioStreamPlaybackPolyphonic::mix(AudioFrame *p_buffer, float p_rate_scale, } if (s.stream_playback->get_is_sample()) { + if (s.finish_request.is_set()) { + s.active.clear(); + AudioServer::get_singleton()->stop_sample_playback(s.stream_playback->get_sample_playback()); + } continue; }