Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
connorslade committed May 31, 2024
1 parent 648c9c0 commit 12c8add
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/misc/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Audio {
.samples::<f32>()
.collect::<Result<Vec<_>, hound::Error>>(),
SampleFormat::Int => {
let denominator = (1u32 << audio_in_spec.bits_per_sample - 1) as f32;
let denominator = (1u32 << (audio_in_spec.bits_per_sample - 1)) as f32;
audio_in_reader
.samples::<i32>()
.map(|x| x.map(|x| x as f32 / denominator))
Expand Down Expand Up @@ -71,7 +71,7 @@ impl Audio {

let audio_in_buffer = device.create_buffer_init(&BufferInitDescriptor {
label: None,
contents: bytemuck::cast_slice(&audio_in),
contents: bytemuck::cast_slice(audio_in),
usage: BufferUsages::STORAGE,
});

Expand Down
9 changes: 5 additions & 4 deletions src/simulation.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{
borrow::Cow,
cmp::Ordering,
f32::consts::PI,
fs::{self, File},
};
Expand Down Expand Up @@ -251,10 +252,10 @@ impl Simulation {
drop(compute_pass);

if let Some(audio) = &mut self.audio {
if audio.audio_in_len == self.tick as usize {
self.running = false;
} else if audio.audio_in_len > self.tick as usize {
audio.tick(self.tick, gc, encoder);
match audio.audio_in_len.cmp(&(self.tick as usize)) {
Ordering::Equal => self.running = false,
Ordering::Greater => audio.tick(self.tick, gc, encoder),
_ => {}
}
}

Expand Down

0 comments on commit 12c8add

Please sign in to comment.