From d6e399973e9bc6447a28b80cacffcbc6a768f1ed Mon Sep 17 00:00:00 2001 From: thajohns Date: Thu, 9 Sep 2021 01:15:22 -0400 Subject: got pre-linking steps working, removed glob includes --- src/synth/sine.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/synth/sine.rs') 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 { 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), })) } -- cgit v1.2.3-70-g09d2