Struct screech::basic::Slew[][src]

pub struct Slew {
    pub value_per_ms: f32,
    // some fields omitted
}
Expand description

Signal slew rate limiter

Limit the speed of change by voltage per millisecond

use screech::core::Signal;
use screech::basic::Slew;

// set a sample rate of 4000 samples per second
let sample_rate = 4000;
let signals = Signal::from_points(vec![1.0, -1.0, -1.0, 1.0, 1.0, -1.0, -1.0, 0.0, 0.0]);
// adjust the speed of the slew rate to be 1.0 "volts" per millisecond
let mut slew = Slew::new(1.0);

assert_eq!(
    signals
        .into_iter()
        .map(|s| *slew.process(sample_rate, s).get_point())
        .collect::<Vec<f32>>(),
    &[0.25, 0.0, -0.25, 0.0, 0.25, 0.0, -0.25, 0.0, 0.0],
);

Fields

value_per_ms: f32

“voltage” or value change per millisecond

Implementations

Initialize a new slew instance

Sets the value per ms on init

Process a crate::core::Signal through the slew rate limiter

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.