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/param.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/synth/param.rs') diff --git a/src/synth/param.rs b/src/synth/param.rs index 602be1d..dd3ecb8 100644 --- a/src/synth/param.rs +++ b/src/synth/param.rs @@ -1,4 +1,7 @@ -use super::*; +use super::{ + mem, FactoryParameters, GenBox, GenFactoryError, Generator, GeneratorFactory, ParamValue, + Parameters, Sample, SampleBuffer, +}; #[derive(Debug)] pub struct Param { @@ -9,10 +12,13 @@ pub struct Param { impl Generator for Param { fn eval<'a>(&'a mut self, params: &Parameters) -> &'a SampleBuffer { - self.buf.set(*params.vars.get(&self.name).unwrap_or(&self.default)); + self.buf + .set(*params.vars.get(&self.name).unwrap_or(&self.default)); + &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) } @@ -24,7 +30,9 @@ impl GeneratorFactory for ParamFactory { fn new(&self, params: &mut FactoryParameters) -> Result { Ok(Box::new(Param { name: params.get_req_param("name", 0)?.as_string()?, - default: params.get_param("default", 1, &mut ParamValue::Float(0.0)).as_f32()?, + default: params + .get_param("default", 1, &mut ParamValue::Float(0.0)) + .as_f32()?, buf: SampleBuffer::new(1), })) } -- cgit v1.2.3-70-g09d2