You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
449 B
23 lines
449 B
pub struct AllPassDelay { |
|
a1: f32, |
|
zm1: f32, |
|
} |
|
|
|
impl AllPassDelay { |
|
pub fn new() -> Self { |
|
AllPassDelay { |
|
a1: 0.0, |
|
zm1: 0.0, |
|
} |
|
} |
|
|
|
pub fn delay(&mut self, delay: f32) { |
|
self.a1 = (1.0 - delay) / (1.0 + delay); |
|
} |
|
|
|
pub fn update(&mut self, in_sample: f32) -> f32 { |
|
let y = in_sample * -self.a1 + self.zm1; |
|
self.zm1 = y * self.a1 + in_sample; |
|
y |
|
} |
|
}
|
|
|