added AllPass::next_linear
This commit is contained in:
parent
e6fad9086b
commit
fa6af749de
1 changed files with 16 additions and 1 deletions
|
@ -1221,7 +1221,8 @@ impl<F: Flt> AllPass<F> {
|
|||
self.delay.tap_n(time_ms)
|
||||
}
|
||||
|
||||
/// Retrieve the next sample from the all-pass filter while feeding in the next.
|
||||
/// Retrieve the next (cubic interpolated) sample from the all-pass
|
||||
/// filter while feeding in the next.
|
||||
///
|
||||
/// * `time_ms` - Delay time in milliseconds.
|
||||
/// * `g` - Feedback factor (usually something around 0.7 is common)
|
||||
|
@ -1233,6 +1234,20 @@ impl<F: Flt> AllPass<F> {
|
|||
self.delay.feed(input);
|
||||
input * g + s
|
||||
}
|
||||
|
||||
/// Retrieve the next (linear interpolated) sample from the all-pass
|
||||
/// filter while feeding in the next.
|
||||
///
|
||||
/// * `time_ms` - Delay time in milliseconds.
|
||||
/// * `g` - Feedback factor (usually something around 0.7 is common)
|
||||
/// * `v` - The new input sample to feed the filter.
|
||||
#[inline]
|
||||
pub fn next_linear(&mut self, time_ms: F, g: F, v: F) -> F {
|
||||
let s = self.delay.linear_interpolate_at(time_ms);
|
||||
let input = v + -g * s;
|
||||
self.delay.feed(input);
|
||||
input * g + s
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
Loading…
Reference in a new issue