aboutsummaryrefslogtreecommitdiffstats
path: root/mumd/src/audio/transformers.rs
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2021-06-19 17:29:04 +0200
committerGustav Sörnäs <gustav@sornas.net>2021-06-19 17:29:04 +0200
commitee13c1662eba47ffe2716bdc26bbfcd0609ff521 (patch)
tree443c4dc15ba7dd897f8de80a8fb094780c1628ae /mumd/src/audio/transformers.rs
parenta3be71e2f6b21ae4c8bac8b7ffd1d3f147357339 (diff)
parent4a1d75e0f5f960c59dfba153212aca4830c28237 (diff)
downloadmum-ee13c1662eba47ffe2716bdc26bbfcd0609ff521.tar.gz
Merge remote-tracking branch 'origin/positional-positioning' into ogg
Diffstat (limited to 'mumd/src/audio/transformers.rs')
-rw-r--r--mumd/src/audio/transformers.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/mumd/src/audio/transformers.rs b/mumd/src/audio/transformers.rs
index 25e28b8..91cf3ac 100644
--- a/mumd/src/audio/transformers.rs
+++ b/mumd/src/audio/transformers.rs
@@ -2,7 +2,7 @@
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]>;
+ fn transform<'a>(&mut self, buf: (opus::Channels, &'a mut [f32])) -> Option<(opus::Channels, &'a mut [f32])>;
}
/// A struct representing a noise gate transform.
@@ -25,7 +25,7 @@ impl NoiseGate {
}
impl Transformer for NoiseGate {
- fn transform<'a>(&mut self, buf: &'a mut [f32]) -> Option<&'a mut [f32]> {
+ fn transform<'a>(&mut self, (channels, buf): (opus::Channels, &'a mut [f32])) -> Option<(opus::Channels, &'a mut [f32])> {
const MUTE_PERCENTAGE: f32 = 0.1;
let max = buf.iter().map(|e| e.abs()).max_by(|a, b| a.partial_cmp(b).unwrap()).unwrap();
@@ -43,7 +43,7 @@ impl Transformer for NoiseGate {
if self.open == 0 {
None
} else {
- Some(buf)
+ Some((channels, buf))
}
}
}