mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-11 21:31:10 +01:00
Fix random multithreaded crash that happens when setting the audio stream on a AudioStreamRandomPitch stream.
This commit is contained in:
parent
e42a091db4
commit
be3b2cf08f
@ -232,12 +232,14 @@ AudioStreamPlaybackMicrophone::AudioStreamPlaybackMicrophone() {
|
||||
////////////////////////////////
|
||||
|
||||
void AudioStreamRandomPitch::set_audio_stream(const Ref<AudioStream> &p_audio_stream) {
|
||||
AudioServer::get_singleton()->lock();
|
||||
audio_stream = p_audio_stream;
|
||||
if (audio_stream.is_valid()) {
|
||||
for (RBSet<AudioStreamPlaybackRandomPitch *>::Element *E = playbacks.front(); E; E = E->next()) {
|
||||
E->get()->playback = audio_stream->instance_playback();
|
||||
}
|
||||
}
|
||||
AudioServer::get_singleton()->unlock();
|
||||
}
|
||||
|
||||
Ref<AudioStream> AudioStreamRandomPitch::get_audio_stream() const {
|
||||
|
Loading…
Reference in New Issue
Block a user