mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Fix floating-point literal used in pattern in example (#705)
This commit is contained in:
@@ -15,10 +15,7 @@ impl AudioCallback for SquareWave {
|
||||
fn callback(&mut self, out: &mut [f32]) {
|
||||
// Generate a square wave
|
||||
for x in out.iter_mut() {
|
||||
*x = match self.phase {
|
||||
0.0...0.5 => self.volume,
|
||||
_ => -self.volume
|
||||
};
|
||||
*x = if self.phase < 0.5 { self.volume } else { -self.volume };
|
||||
self.phase = (self.phase + self.phase_inc) % 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user