From 85925d69e08455bd91d32a27cd3690c9cb634a6b Mon Sep 17 00:00:00 2001 From: Graham Northup Date: Mon, 18 Sep 2017 23:12:14 -0400 Subject: Initial work on modular synthesis --- src/synth/param.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/synth/param.rs (limited to 'src/synth/param.rs') diff --git a/src/synth/param.rs b/src/synth/param.rs new file mode 100644 index 0000000..3177ffd --- /dev/null +++ b/src/synth/param.rs @@ -0,0 +1,14 @@ +use super::*; + +pub struct Param { + name: String, + default: Sample, + buf: SampleBuffer, +} + +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 + } +} -- cgit v1.2.3-70-g09d2