From 2687a393b5e4cb083e4347662332d58801064e51 Mon Sep 17 00:00:00 2001 From: awtterpip <107778087+awtterpip@users.noreply.github.com> Date: Tue, 7 Feb 2023 10:34:10 -0600 Subject: [PATCH] fixed bug where sound wasn't stoppable --- src/nodes/audio.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nodes/audio.rs b/src/nodes/audio.rs index f14f794..2566e47 100644 --- a/src/nodes/audio.rs +++ b/src/nodes/audio.rs @@ -42,9 +42,9 @@ impl Sound { pending_audio_path: OnceCell::new(), sk_sound: OnceCell::new(), }; + let sound_arc = SOUND_REGISTRY.add(sound); node.add_local_signal("play", Sound::play_flex); node.add_local_signal("stop", Sound::stop_flex); - let sound_arc = SOUND_REGISTRY.add(sound); let _ = sound_arc.pending_audio_path.set( sound_arc .resource_id @@ -81,7 +81,7 @@ impl Sound { }) .ok(); if let Some(sk_sound) = sk_sound { - sk_sound.play_sound(sound.space.global_transform().to_scale_rotation_translation().2, sound.volume); + sound.instance.lock().replace(sk_sound.play_sound(sound.space.global_transform().to_scale_rotation_translation().2, sound.volume)); } Ok(())