Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
tesselode committed Dec 24, 2024
1 parent 644342b commit 8e2346e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
11 changes: 3 additions & 8 deletions crates/kira/src/sound/static_sound/sound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,9 @@ impl StaticSound {
}

fn push_frame_to_resampler(&mut self) {
let frame = if self.transport.playing {
Some(
frame_at_index(self.transport.position, &self.frames, self.slice)
.unwrap_or_default(),
)
} else {
None
};
let frame = self.transport.playing.then(|| {
frame_at_index(self.transport.position, &self.frames, self.slice).unwrap_or_default()
});
self.resampler.push_frame(frame, self.transport.position);
}

Expand Down
4 changes: 1 addition & 3 deletions crates/kira/src/sound/static_sound/sound/resampler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ impl Resampler {
self.time_until_empty = self.time_until_empty.saturating_sub(1);
}
let frame = frame.unwrap_or_default();
for i in 0..self.frames.len() - 1 {
self.frames[i] = self.frames[i + 1];
}
self.frames.copy_within(1.., 0);
self.frames[self.frames.len() - 1] = RecentFrame {
frame,
frame_index: sample_index,
Expand Down

0 comments on commit 8e2346e

Please sign in to comment.