diff options
author | thajohns <thajohns@clarkson.edu> | 2021-09-09 01:15:22 -0400 |
---|---|---|
committer | Graham Northup <grahamnorthup@yahoo.com> | 2021-09-10 04:05:55 -0400 |
commit | d6e399973e9bc6447a28b80cacffcbc6a768f1ed (patch) | |
tree | 772939eb5d49bdb6ee8e5d632f2224867f6e817d /src/synth/sine.rs | |
parent | ee11b17c0e2796bd3d843a8a516c12453af75927 (diff) |
got pre-linking steps working, removed glob includes
Diffstat (limited to 'src/synth/sine.rs')
-rw-r--r-- | src/synth/sine.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/synth/sine.rs b/src/synth/sine.rs index 4476d4a..3be79db 100644 --- a/src/synth/sine.rs +++ b/src/synth/sine.rs @@ -1,5 +1,8 @@ +use super::{ + mem, FactoryParameters, GenBox, GenFactoryError, Generator, GeneratorFactory, ParamValue, + Parameters, Rate, SampleBuffer, +}; use std::f32::consts::PI; -use super::*; const TAU: f32 = 2f32 * PI; @@ -22,7 +25,9 @@ impl Generator for Sine { self.phase = (self.phase + pvel * (self.buf.len() as f32)) % TAU; &self.buf } - fn buffer(&self) -> &SampleBuffer { &self.buf } + fn buffer(&self) -> &SampleBuffer { + &self.buf + } fn set_buffer(&mut self, buf: SampleBuffer) -> SampleBuffer { mem::replace(&mut self.buf, buf) } @@ -34,7 +39,9 @@ impl GeneratorFactory for SineFactory { fn new(&self, params: &mut FactoryParameters) -> Result<GenBox, GenFactoryError> { Ok(Box::new(Sine { freq: params.remove_param("freq", 0)?.into_gen()?, - phase: params.get_param("phase", 1, &mut ParamValue::Float(0.0)).as_f32()?, + phase: params + .get_param("phase", 1, &mut ParamValue::Float(0.0)) + .as_f32()?, buf: SampleBuffer::new(params.env.default_buffer_size), })) } |