From 2b22b39b08c499798efcb874db6e6268eef43a52 Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 9 Nov 2021 21:07:24 -0600 Subject: Fix: module visibility warnings, Add: MonoSynth::envelope stub --- klangfarbrs/src/adsr.rs | 2 +- klangfarbrs/src/lib.rs | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'klangfarbrs') diff --git a/klangfarbrs/src/adsr.rs b/klangfarbrs/src/adsr.rs index ca03735..682cc8a 100644 --- a/klangfarbrs/src/adsr.rs +++ b/klangfarbrs/src/adsr.rs @@ -7,7 +7,7 @@ pub struct Envelope { } impl Envelope { - fn new(attack: Millisecond, decay: Millisecond, sustain: Amplitude, release: Millisecond) -> Self { + pub fn new(attack: Millisecond, decay: Millisecond, sustain: Amplitude, release: Millisecond) -> Self { let attack = vec![sustain; attack as usize]; let decay = vec![sustain; decay as usize]; let release = vec![sustain; release as usize]; diff --git a/klangfarbrs/src/lib.rs b/klangfarbrs/src/lib.rs index 087cbd7..0fc7936 100644 --- a/klangfarbrs/src/lib.rs +++ b/klangfarbrs/src/lib.rs @@ -13,9 +13,10 @@ use gdnative::prelude::*; use gdnative::core_types::TypedArray; mod osc; -use osc::{Osc}; +use osc::Osc; -mod adsr; +pub mod adsr; +use adsr::Envelope; /// Aliasing some types to distinguish various audio properties. type Sample = f32; @@ -184,6 +185,13 @@ impl MonoSynth { self.fm_depth = fm_depth } + fn envelope( + &self, _owner: &Node, + attack: Millisecond, decay: Millisecond, sustain: Amplitude, release: Millisecond + ) -> Envelope { + Envelope::new(attack, decay, sustain, release) + } + #[export] pub fn frames(&mut self, _owner: &Node, samples: i32) -> TypedArray { let mut frames = TypedArray::new(); -- cgit v1.2.3