Skip to content

Commit

Permalink
sync sound buffer first, then playback position
Browse files Browse the repository at this point in the history
- part of #406
  • Loading branch information
mrDIMAS committed Nov 18, 2022
1 parent 70f226d commit 4b3093c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/scene/sound/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ impl SoundContext {
if sound.native.get().is_some() {
let mut state = self.native.state();
let source = state.source_mut(sound.native.get());

sound.buffer.try_sync_model(|v| {
Log::verify(source.set_buffer(v));
});
sound.max_distance.try_sync_model(|v| {
source.set_max_distance(v);
});
Expand Down Expand Up @@ -284,9 +286,6 @@ impl SoundContext {
sound
.spatial_blend
.try_sync_model(|v| source.set_spatial_blend(v));
sound.buffer.try_sync_model(|v| {
Log::verify(source.set_buffer(v));
});
sound.status.try_sync_model(|v| match v {
Status::Stopped => {
Log::verify(source.stop());
Expand Down

0 comments on commit 4b3093c

Please sign in to comment.