Skip to content

Commit

Permalink
fix: post-merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SolarLiner committed Mar 23, 2024
1 parent 321f758 commit ed46586
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
11 changes: 6 additions & 5 deletions examples/diodeclipper/src/dsp.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use enum_map::Enum;
use num_traits::Zero;
use std::fmt;
use std::fmt::Formatter;

use enum_map::Enum;
use num_traits::Zero;

use valib::dsp::parameter::{HasParameters, Parameter, SmoothedParam};
use valib::dsp::{DSPBlock, PerSampleBlockAdapter, DSP};
use valib::dsp::{DSPBlock, DSP};
use valib::filters::biquad::Biquad;
use valib::oversample::{Oversample, Oversampled};
use valib::saturators::clippers::{DiodeClipper, DiodeClipperModel};
Expand Down Expand Up @@ -40,11 +41,11 @@ impl<T: Scalar> DSP<1, 1> for DcBlocker<T> {
}

fn latency(&self) -> usize {
self.0.latency()
DSP::latency(&self.0)
}

fn set_samplerate(&mut self, samplerate: f32) {
self.0.set_samplerate(samplerate);
DSP::set_samplerate(&mut self.0, samplerate);
self.0.update_coefficients(&Biquad::highpass(
T::from_f64((Self::CUTOFF_HZ / samplerate) as f64),
T::from_f64(Self::Q as f64),
Expand Down
3 changes: 2 additions & 1 deletion examples/saturators/src/dsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ impl HasParameters for Dsp {
}

pub fn create_dsp(samplerate: f32, oversample: usize, max_block_size: usize) -> Dsp {
let inner = Oversample::new(oversample, max_block_size).with_dsp(DspInner::new(samplerate));
let inner =
Oversample::new(oversample, max_block_size).with_dsp(samplerate, DspInner::new(samplerate));
Dsp {
inner,
oversample_amount: Parameter::new(2.0),
Expand Down
17 changes: 12 additions & 5 deletions examples/saturators/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ impl Default for SaturatorsPlugin {
)
.with_unit(" dB")
.with_value_to_string(formatters::v2s_f32_gain_to_db(2))
.with_string_to_value(formatters::s2v_f32_gain_to_db()),
.with_string_to_value(formatters::s2v_f32_gain_to_db())
.into(),
DspParams::InnerParam(DspInnerParams::Saturator) => FloatParam::new(
"Saturator",
0.0,
Expand All @@ -46,7 +47,8 @@ impl Default for SaturatorsPlugin {
},
)
.with_step_size(1.0)
.with_value_to_string(Arc::new(|x| SaturatorType::from_usize(x as _).name())),
.with_value_to_string(Arc::new(|x| SaturatorType::from_usize(x as _).name()))
.into(),
DspParams::InnerParam(DspInnerParams::Feedback) => FloatParam::new(
"Feedback",
0.0,
Expand All @@ -59,11 +61,13 @@ impl Default for SaturatorsPlugin {
)
.with_unit(" %")
.with_value_to_string(formatters::v2s_f32_percentage(2))
.with_string_to_value(formatters::s2v_f32_percentage()),
.with_string_to_value(formatters::s2v_f32_percentage())
.into(),
DspParams::InnerParam(DspInnerParams::AdaaLevel) => {
FloatParam::new("ADAA Level", 2.0, FloatRange::Linear { min: 0.0, max: 2.0 })
.with_step_size(1.0)
.with_value_to_string(formatters::v2s_f32_rounded(0))
.into()
}
DspParams::InnerParam(DspInnerParams::AdaaEpsilon) => FloatParam::new(
"ADAA Epsilon",
Expand All @@ -74,7 +78,8 @@ impl Default for SaturatorsPlugin {
factor: 2.0,
},
)
.with_value_to_string(Arc::new(|f| format!("{f:.1e}"))),
.with_value_to_string(Arc::new(|f| format!("{f:.1e}")))
.into(),
DspParams::Oversampling => FloatParam::new(
"Oversampling",
OVERSAMPLE as _,
Expand All @@ -84,11 +89,13 @@ impl Default for SaturatorsPlugin {
},
)
.with_unit("x")
.with_step_size(1.0),
.with_step_size(1.0)
.into(),
DspParams::DcBlocker => {
FloatParam::new("Block DC", 1.0, FloatRange::Linear { min: 0.0, max: 1.0 })
.with_step_size(1.0)
.with_value_to_string(Arc::new(|f| format!("{}", f > 0.5)))
.into()
}
});
Self {
Expand Down
9 changes: 0 additions & 9 deletions src/oversample/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,6 @@ impl<T, P> Oversampled<T, P> {
pub fn os_factor(&self) -> usize {
self.oversampling.os_factor
}
}

impl<T, P> Oversampled<T, P>
where
T: Scalar,
{
pub fn set_oversampling_amount(&mut self, amt: usize) {
self.oversampling.set_oversampling_amount(amt);
}

pub fn into_inner(self) -> P {
self.inner
Expand Down

0 comments on commit ed46586

Please sign in to comment.