From e9f7f2b9ff6505e2e3975515f77faf7efddf9deb Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Mon, 10 May 2021 17:23:54 -0500 Subject: [PATCH] Partial fix for pausing/resuming sources. --- src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index b23c74a..2938149 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -236,7 +236,12 @@ fn source_update( } } SoundState::Playing => { - if sound.source.is_none() { + if let Some(source) = sound.source.as_mut() { + let source_state = source.state(); + if source_state == SourceState::Paused { + source.play(); + } + } else { let mut source = context.new_static_source().unwrap(); if let Some(buffer) = buffers.0.get(&sound.buffer.id) { source.set_buffer(buffer.clone()).unwrap();