summaryrefslogtreecommitdiff
path: root/klangfarbrs
diff options
context:
space:
mode:
authorGrant Shangreaux <grant@unabridgedsoftware.com>2021-11-09 21:07:24 -0600
committerGrant Shangreaux <grant@unabridgedsoftware.com>2021-11-09 21:07:24 -0600
commit2b22b39b08c499798efcb874db6e6268eef43a52 (patch)
tree1515e6f416ee7a6c647dc43265a55806a24cd19b /klangfarbrs
parente2aec3161f791614fc19fc50a4dadf239d7422ad (diff)
Fix: module visibility warnings, Add: MonoSynth::envelope stub
Diffstat (limited to 'klangfarbrs')
-rw-r--r--klangfarbrs/src/adsr.rs2
-rw-r--r--klangfarbrs/src/lib.rs12
2 files changed, 11 insertions, 3 deletions
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<Vector2> {
let mut frames = TypedArray::new();