Skip to content

Commit

Permalink
Remove changes to frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
mlindner committed Nov 15, 2018
1 parent 15cd262 commit 9b86f42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/source/sine.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::time::Duration;
use Source;

const PI_2: f32 = std::f32::consts::PI * 2.0;
const PI_2 = std::f32::consts::PI * 2.0f32;

/// An infinite source that produces a sine.
///
/// Always has a rate of 44.1kHz and one channel.
/// Always has a rate of 48kHz and one channel.
#[derive(Clone, Debug)]
pub struct SineWave {
freq: f32,
Expand All @@ -28,7 +28,7 @@ impl Iterator for SineWave {

#[inline]
fn next(&mut self) -> Option<f32> {
self.cur_val += PI_2 * self.freq / 44100.0;
self.cur_val += PI_2 * self.freq / 48000.0;
if self.cur_val > PI_2 {
self.cur_val -= PI_2;
}
Expand Down

0 comments on commit 9b86f42

Please sign in to comment.