diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp index a3f22160615..edf7f9451a4 100644 --- a/servers/audio/audio_stream.cpp +++ b/servers/audio/audio_stream.cpp @@ -231,12 +231,14 @@ AudioStreamPlaybackMicrophone::AudioStreamPlaybackMicrophone() { //////////////////////////////// void AudioStreamRandomPitch::set_audio_stream(const Ref &p_audio_stream) { + AudioServer::get_singleton()->lock(); audio_stream = p_audio_stream; if (audio_stream.is_valid()) { for (Set::Element *E = playbacks.front(); E; E = E->next()) { E->get()->playback = audio_stream->instance_playback(); } } + AudioServer::get_singleton()->unlock(); } Ref AudioStreamRandomPitch::get_audio_stream() const {