Skip to content

Commit

Permalink
old functions now call with q functions
Browse files Browse the repository at this point in the history
The low_pass, etc. now just call low_pass_with_q while also passing  the original default q value of 0.5
  • Loading branch information
xwillxw committed Oct 6, 2023
1 parent 4112e55 commit 0fc0aaa
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions src/source/blt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,14 @@ pub fn low_pass<I>(input: I, freq: u32) -> BltFilter<I>
where
I: Source<Item = f32>,
{
BltFilter {
input,
formula: BltFormula::LowPass { freq, q: 0.5 },
applier: None,
x_n1: 0.0,
x_n2: 0.0,
y_n1: 0.0,
y_n2: 0.0,
}
low_pass_with_q(input, freq, 0.5)
}

pub fn high_pass<I>(input: I, freq: u32) -> BltFilter<I>
where
I: Source<Item = f32>,
{
BltFilter {
input,
formula: BltFormula::HighPass { freq, q: 0.5 },
applier: None,
x_n1: 0.0,
x_n2: 0.0,
y_n1: 0.0,
y_n2: 0.0,
}
high_pass_with_q(input, freq, 0.5)
}

/// Same as low_pass but allows the q value (bandwidth) to be changed
Expand Down Expand Up @@ -82,14 +66,12 @@ pub struct BltFilter<I> {
impl<I> BltFilter<I> {
/// Modifies this filter so that it becomes a low-pass filter.
pub fn to_low_pass(&mut self, freq: u32) {
self.formula = BltFormula::LowPass { freq, q: 0.5 };
self.applier = None;
self.to_low_pass_with_q(freq, 0.5);
}

/// Modifies this filter so that it becomes a high-pass filter
pub fn to_high_pass(&mut self, freq: u32) {
self.formula = BltFormula::HighPass { freq, q: 0.5 };
self.applier = None;
self.to_high_pass_with_q(freq, 0.5);
}

/// Same as to_low_pass but allows the q value (bandwidth) to be changed
Expand Down

0 comments on commit 0fc0aaa

Please sign in to comment.