#[repr(C)]pub struct Param {
pub current: f32,
pub target: f32,
pub step: f32,
}Expand description
A single smoothed parameter. Uses a linear ramp: current += step each sample until target is reached.
Fields§
§current: f32§target: f32§step: f32Per-sample increment. Set by set_target.
Implementations§
Source§impl Param
impl Param
pub fn new(value: f32) -> Self
Sourcepub fn set_target(&mut self, target: f32, ramp_samples: u32)
pub fn set_target(&mut self, target: f32, ramp_samples: u32)
Schedule a ramp to target over ramp_samples samples.
Call from the control thread before pushing a UpdateParam command.
Sourcepub fn fill_buffer(&mut self, out: &mut [f32])
pub fn fill_buffer(&mut self, out: &mut [f32])
Advance by a full buffer, returning per-sample values into out.
Avoids branching inside the hot loop.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Param
impl RefUnwindSafe for Param
impl Send for Param
impl Sync for Param
impl Unpin for Param
impl UnsafeUnpin for Param
impl UnwindSafe for Param
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more