aboutsummaryrefslogtreecommitdiffstats
path: root/mumd/src/audio/transformers.rs
diff options
context:
space:
mode:
authorEskil Queseth <eskilq@kth.se>2021-06-12 17:40:41 +0200
committerEskil Queseth <eskilq@kth.se>2021-06-12 17:40:41 +0200
commitc143931f9948a0249213bdaab2658a31d4dddaf2 (patch)
tree000ab97247b66aaf31215df4eb564f47119d3c70 /mumd/src/audio/transformers.rs
parentd67ab0c4b37a4e32d874d7dc9aa4c4b43376f80d (diff)
downloadmum-c143931f9948a0249213bdaab2658a31d4dddaf2.tar.gz
add documentation
Diffstat (limited to 'mumd/src/audio/transformers.rs')
-rw-r--r--mumd/src/audio/transformers.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/mumd/src/audio/transformers.rs b/mumd/src/audio/transformers.rs
index 6994a40..25e28b8 100644
--- a/mumd/src/audio/transformers.rs
+++ b/mumd/src/audio/transformers.rs
@@ -1,7 +1,11 @@
+/// A trait that represents a transform of a audio buffer in some way.
pub trait Transformer {
+ /// Do the transform. Returning `None` is interpreted as "the buffer is unwanted".
+ /// The implementor is free to modify the buffer however it wants to.
fn transform<'a>(&mut self, buf: &'a mut [f32]) -> Option<&'a mut [f32]>;
}
+/// A struct representing a noise gate transform.
pub struct NoiseGate {
alltime_high: f32,
open: usize,
@@ -9,6 +13,8 @@ pub struct NoiseGate {
}
impl NoiseGate {
+ /// Create a new noise gate. `deactivation_delay` is defined in terms of
+ /// how many quiet frames it receives before closing the noise gate.
pub fn new(deactivation_delay: usize) -> Self {
Self {
alltime_high: 0.0,