diff options
Diffstat (limited to 'klangfarbrs/src/instrument.rs')
-rw-r--r-- | klangfarbrs/src/instrument.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/klangfarbrs/src/instrument.rs b/klangfarbrs/src/instrument.rs index bf08fe4..6fc797b 100644 --- a/klangfarbrs/src/instrument.rs +++ b/klangfarbrs/src/instrument.rs @@ -2,6 +2,7 @@ use super::{ Partial, Sample, Hz, SamplesPerSecond }; pub struct Instrument { pub partials: Vec<Partial>, + pub complete: bool, } impl Instrument { @@ -9,7 +10,8 @@ impl Instrument { Self { partials: partial_multipliers.iter() .map(|&p| Partial::new(1.0, 1.0, p, 0.0, sample_rate, 2000, base_freq)) - .collect() + .collect(), + complete: false, } } @@ -32,6 +34,7 @@ impl Iterator for Instrument { .map(|i| i.unwrap()).collect(); if filtered.is_empty() { + self.complete = true; None } else { Some(filtered.iter().sum()) |