apply better clamping for the tpt filters

This commit is contained in:
Weird Constructor 2021-07-10 22:48:20 +02:00
parent ebb5dd3a9b
commit 6f14af5293

View file

@ -88,7 +88,8 @@ impl DspNode for SFilter {
0 => {
for frame in 0..ctx.nframes() {
let input = inp.read(frame) as f64;
let freq = (denorm::SFilter::freq(freq, frame) as f64);
let freq = denorm::SFilter::freq(freq, frame) as f64;
let freq = freq.clamp(10.0, 22050.0);
out.write(frame,
process_1pole_lowpass(
input, freq, self.israte, &mut self.z)
@ -98,7 +99,8 @@ impl DspNode for SFilter {
1 => {
for frame in 0..ctx.nframes() {
let input = inp.read(frame) as f64;
let freq = (denorm::SFilter::freq(freq, frame) as f64);
let freq = denorm::SFilter::freq(freq, frame) as f64;
let freq = freq.clamp(10.0, 18000.0);
out.write(frame,
process_1pole_tpt_lowpass(
input, freq, self.israte, &mut self.z)
@ -108,7 +110,8 @@ impl DspNode for SFilter {
2 => {
for frame in 0..ctx.nframes() {
let input = inp.read(frame) as f64;
let freq = (denorm::SFilter::freq(freq, frame) as f64);
let freq = denorm::SFilter::freq(freq, frame) as f64;
let freq = freq.clamp(10.0, 22050.0);
out.write(frame,
process_1pole_highpass(
input, freq, self.israte, &mut self.z, &mut self.y)
@ -118,7 +121,8 @@ impl DspNode for SFilter {
3 => {
for frame in 0..ctx.nframes() {
let input = inp.read(frame) as f64;
let freq = (denorm::SFilter::freq(freq, frame) as f64);
let freq = denorm::SFilter::freq(freq, frame) as f64;
let freq = freq.clamp(10.0, 18000.0);
out.write(frame,
process_1pole_tpt_highpass(
input, freq, self.israte, &mut self.z)