BiquadClamp

Struct BiquadClamp 

Source
pub struct BiquadClamp<C, T = C> {
    pub coeff: Biquad<C>,
    pub u: T,
    pub min: T,
    pub max: T,
}
Expand description

Second-order-section with offset and clamp

Fields§

§coeff: Biquad<C>

Coefficients

§u: T

Summing junction offset

let mut i = BiquadClamp::<f32>::default();
i.u = 5.0;
assert_eq!(i.process(&mut DirectForm1::default(), 0.0), 5.0);
§min: T

Summing junction lower limit

let mut i = BiquadClamp::<f32>::default();
i.min = 5.0;
assert_eq!(i.process(&mut DirectForm1::default(), 0.0), 5.0);
§max: T

Summing junction upper limit

let mut i = BiquadClamp::<f32>::default();
i.max = -5.0;
assert_eq!(i.process(&mut DirectForm1::default(), 0.0), -5.0);

Implementations§

Source§

impl<C: Copy + Add<Output = C>, T: Copy + Div<C, Output = T> + Mul<C, Output = T>> BiquadClamp<C, T>

Source

pub fn input_offset(&self) -> T

Summing junction offset referred to input

let mut i = BiquadClamp::from(Biquad::proportional(3.0));
i.u = 6.0;
assert_eq!(i.input_offset(), 2.0);
Source

pub fn set_input_offset(&mut self, i: T)

Summing junction offset referred to input

let mut i = BiquadClamp::from(Biquad::proportional(3.0));
i.set_input_offset(2.0);
assert_eq!(i.u, 6.0);

Trait Implementations§

Source§

impl<T, Y, C> Build<BiquadClamp<C, Y>> for Pid<T>
where Y: 'static + Copy + Mul<C, Output = Y> + Div<C, Output = Y>, C: Add<Output = C> + Copy, T: AsPrimitive<Y> + Float, BiquadClamp<C, Y>: From<[C; 5]>, Builder<T>: Build<[C; 5], Context = T>,

Source§

fn build(&self, units: &Units<T>) -> BiquadClamp<C, Y>

Return the Biquad

Builder intermediate type I, coefficient type C

Source§

type Context = Units<T>

The context of the convesion. Read more
Source§

impl<C: Clone, T: Clone> Clone for BiquadClamp<C, T>

Source§

fn clone(&self) -> BiquadClamp<C, T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C: Debug, T: Debug> Debug for BiquadClamp<C, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C, T: Clamp> Default for BiquadClamp<C, T>
where Biquad<C>: Default,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, C, T> Deserialize<'de> for BiquadClamp<C, T>
where C: Deserialize<'de>, T: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<C, T, F> From<F> for BiquadClamp<C, T>
where F: Into<Biquad<C>>, Self: Default,

Source§

fn from(coeff: F) -> Self

Converts to this type from the input type.
Source§

impl<C: PartialEq, T: PartialEq> PartialEq for BiquadClamp<C, T>

Source§

fn eq(&self, other: &BiquadClamp<C, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<C: PartialOrd, T: PartialOrd> PartialOrd for BiquadClamp<C, T>

Source§

fn partial_cmp(&self, other: &BiquadClamp<C, T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<C, T> Serialize for BiquadClamp<C, T>
where C: Serialize, T: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<C, T: Copy, S> SplitInplace<T, S> for BiquadClamp<C, T>
where Self: SplitProcess<T, T, S>,

§

fn inplace(&self, state: &mut S, xy: &mut [X])

See also [Inplace::inplace]
Source§

impl<T: Copy + Add<Output = T> + PartialOrd, C> SplitProcess<T, T, DirectForm1<T>> for BiquadClamp<C, T>
where Biquad<C>: SplitProcess<T, T, DirectForm1<T>>,

use dsp_process::SplitProcess;
use idsp::iir::*;
let biquad = BiquadClamp::<f32, f32>::from(Biquad::IDENTITY);
let mut state = DirectForm2Transposed::default();
let x = 3.0f32;
let y = biquad.process(&mut state, x);
assert_eq!(x, y);
Source§

fn process(&self, state: &mut DirectForm1<T>, x0: T) -> T

Process an input into an output Read more
§

fn block(&self, state: &mut S, x: &[X], y: &mut [Y])

Process a block of inputs Read more
Source§

impl<T: Copy + Add<Output = T> + Mul<Output = T> + PartialOrd> SplitProcess<T, T, DirectForm2Transposed<T>> for BiquadClamp<T, T>

Source§

fn process(&self, state: &mut DirectForm2Transposed<T>, x0: T) -> T

Process an input into an output Read more
§

fn block(&self, state: &mut S, x: &[X], y: &mut [Y])

Process a block of inputs Read more
Source§

impl<const F: i8> SplitProcess<i32, i32, DirectForm1Dither> for BiquadClamp<Q<i32, i64, F>, i32>

Source§

fn process(&self, state: &mut DirectForm1Dither, x0: i32) -> i32

Process an input into an output Read more
§

fn block(&self, state: &mut S, x: &[X], y: &mut [Y])

Process a block of inputs Read more
Source§

impl<const F: i8> SplitProcess<i32, i32, DirectForm1Wide> for BiquadClamp<Q<i32, i64, F>, i32>

Source§

fn process(&self, state: &mut DirectForm1Wide, x0: i32) -> i32

Process an input into an output Read more
§

fn block(&self, state: &mut S, x: &[X], y: &mut [Y])

Process a block of inputs Read more
Source§

impl<C, T> StructuralPartialEq for BiquadClamp<C, T>

Auto Trait Implementations§

§

impl<C, T> Freeze for BiquadClamp<C, T>
where T: Freeze, C: Freeze,

§

impl<C, T> RefUnwindSafe for BiquadClamp<C, T>

§

impl<C, T> Send for BiquadClamp<C, T>
where T: Send, C: Send,

§

impl<C, T> Sync for BiquadClamp<C, T>
where T: Sync, C: Sync,

§

impl<C, T> Unpin for BiquadClamp<C, T>
where T: Unpin, C: Unpin,

§

impl<C, T> UnwindSafe for BiquadClamp<C, T>
where T: UnwindSafe, C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,