summaryrefslogtreecommitdiff
path: root/klangfarbrs/src/instrument.rs
diff options
context:
space:
mode:
Diffstat (limited to 'klangfarbrs/src/instrument.rs')
-rw-r--r--klangfarbrs/src/instrument.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/klangfarbrs/src/instrument.rs b/klangfarbrs/src/instrument.rs
index 3a929af..65da6b6 100644
--- a/klangfarbrs/src/instrument.rs
+++ b/klangfarbrs/src/instrument.rs
@@ -5,6 +5,15 @@ struct Instrument {
envelope: Envelope,
}
+impl Instrument {
+ pub fn sample(&mut self) -> Sample {
+ match self.next() {
+ Some(s) => { s },
+ None => 0.0
+ }
+ }
+}
+
impl Iterator for Instrument {
type Item = Sample;