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/triangle.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/synth/triangle.rs') diff --git a/src/synth/triangle.rs b/src/synth/triangle.rs index 944c539..7d88ec1 100644 --- a/src/synth/triangle.rs +++ b/src/synth/triangle.rs @@ -1,5 +1,8 @@ +use super::{ + FactoryParameters, GenBox, GenFactoryError, Generator, GeneratorFactory, ParamValue, + Parameters, Rate, SampleBuffer, +}; use std::mem; -use super::*; #[derive(Debug)] pub struct Triangle { @@ -27,7 +30,9 @@ impl Generator for Triangle { self.phase = (self.phase + pvel * (self.buf.len() as f32)) % 1.0; &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) } @@ -39,7 +44,9 @@ impl GeneratorFactory for TriangleFactory { fn new(&self, params: &mut FactoryParameters) -> Result { Ok(Box::new(Triangle { 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