pub struct Ramp<C = MonotonicCurveLut256> {
pub duration_ms: u32,
pub from: u16,
pub to: u16,
pub curve: C,
pub step: u16,
pub rounding: Rounding,
pub min_dt_ms: u32,
pub lra_frequency_hz: Option<u16>,
pub lra_frequency_hz_to: Option<u16>,
}Expand description
A curve-shaped transition from from to to.
Fields§
§duration_ms: u32Segment duration in milliseconds.
from: u16Starting normalized level (0..=u16::MAX).
to: u16Ending normalized level (0..=u16::MAX).
curve: CMonotonic curve used to shape progress over time.
step: u16Output quantization step (minimum 1).
rounding: RoundingQuantization rounding mode.
min_dt_ms: u32Minimum milliseconds between output changes.
lra_frequency_hz: Option<u16>Optional per-segment LRA frequency override.
lra_frequency_hz_to: Option<u16>Optional ending LRA frequency for frequency sweeps.
This is used only when Self::lra_frequency_hz also contains the
starting frequency; otherwise it is ignored.
Implementations§
Source§impl<C> Ramp<C>
impl<C> Ramp<C>
Sourcepub const fn new(duration_ms: u32, from: u16, to: u16, curve: C) -> Self
pub const fn new(duration_ms: u32, from: u16, to: u16, curve: C) -> Self
Build a new ramp segment.
A zero duration_ms is normalized to one millisecond. Direct struct
construction does not perform this normalization.
Sourcepub const fn with_quantization(self, step: u16, rounding: Rounding) -> Self
pub const fn with_quantization(self, step: u16, rounding: Rounding) -> Self
Override quantization settings.
A zero step is normalized to 1.
Sourcepub const fn with_min_dt(self, min_dt_ms: u32) -> Self
pub const fn with_min_dt(self, min_dt_ms: u32) -> Self
Set a minimum time between consecutive output changes.
Sourcepub const fn with_lra_frequency(self, frequency_hz: u16) -> Self
pub const fn with_lra_frequency(self, frequency_hz: u16) -> Self
Override LRA frequency for this segment.