diff options
author | Jacob Lee <jacob@unabridgedsoftware.com> | 2021-12-04 10:59:14 -0500 |
---|---|---|
committer | Jacob Lee <jacob@unabridgedsoftware.com> | 2021-12-04 10:59:14 -0500 |
commit | 4924c965542392fe5d092c84f3eddc35afd8f7e2 (patch) | |
tree | 7f2eb74d67893156aa41fb70936e88ef4bdf0a34 /klangfarbrs/src/lib.rs | |
parent | e91c02971c08a180a3b1dc3dee9a0b035a79fa95 (diff) |
Remove hacky trick for instrument and update the instrument in the trigger method on the synth instead
Diffstat (limited to 'klangfarbrs/src/lib.rs')
-rw-r--r-- | klangfarbrs/src/lib.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/klangfarbrs/src/lib.rs b/klangfarbrs/src/lib.rs index e60e7b3..de3322a 100644 --- a/klangfarbrs/src/lib.rs +++ b/klangfarbrs/src/lib.rs @@ -215,6 +215,7 @@ impl MonoSynth { #[export] fn trigger(&mut self, _owner: &Node, ) { + self.instrument = Instrument::new(self.frequency, vec![0.56, 0.92, 1.19, 1.7, 2.0, 2.74, 3.0, 3.76, 4.07], self.sample_rate); self.envelope = Envelope::new(self.attack, self.decay, self.sustain, self.release, self.sample_rate); } @@ -250,11 +251,6 @@ impl MonoSynth { } } - // TODO: For now this enables the instrument to be played multiple times. Would like to find a cleaner way to do this. - if self.instrument.complete { - self.instrument = Instrument::new(self.frequency, vec![0.56, 0.92, 1.19, 1.7, 2.0, 2.74, 3.0, 3.76, 4.07], self.sample_rate) - } - frames.push(Vector2::new(sample, sample)); } |