diff options
Diffstat (limited to 'src/synth/param.rs')
-rw-r--r-- | src/synth/param.rs | 14 |
1 files changed, 14 insertions, 0 deletions
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 + } +} |