Partial fix for pausing/resuming sources.

This commit is contained in:
Nolan Darilek 2021-05-10 17:23:54 -05:00
parent ba375532b6
commit e9f7f2b9ff

View File

@ -236,7 +236,12 @@ fn source_update(
} }
} }
SoundState::Playing => { 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(); let mut source = context.new_static_source().unwrap();
if let Some(buffer) = buffers.0.get(&sound.buffer.id) { if let Some(buffer) = buffers.0.get(&sound.buffer.id) {
source.set_buffer(buffer.clone()).unwrap(); source.set_buffer(buffer.clone()).unwrap();