pub struct ParameterRange {
pub min: f32,
pub max: f32,
pub default: f32,
pub scale: ParameterScale,
}Expand description
Parameter range with scaling for automation and plugin parameters.
Stores the valid range and default value, and provides conversion between normalized (0.0-1.0) and real parameter values.
Fields§
§min: f32§max: f32§default: f32§scale: ParameterScaleImplementations§
Source§impl ParameterRange
impl ParameterRange
pub fn new(min: f32, max: f32, default: f32, scale: ParameterScale) -> Self
pub fn linear(min: f32, max: f32, default: f32) -> Self
Sourcepub fn logarithmic(min: f32, max: f32, default: f32) -> Self
pub fn logarithmic(min: f32, max: f32, default: f32) -> Self
Create a logarithmic parameter range (for frequencies, gains).
§Panics
Panics in debug mode if min <= 0.
Sourcepub fn exponential(min: f32, max: f32, default: f32, curve: f32) -> Self
pub fn exponential(min: f32, max: f32, default: f32, curve: f32) -> Self
curve shape factor: values > 1.0 give more resolution at low end.
pub fn toggle(off_value: f32, on_value: f32, default_on: bool) -> Self
pub fn integer(min: i32, max: i32, default: i32) -> Self
pub fn normalize(&self, value: f32) -> f32
pub fn denormalize(&self, normalized: f32) -> f32
pub fn clamp(&self, value: f32) -> f32
pub fn default_normalized(&self) -> f32
pub fn contains(&self, value: f32) -> bool
pub fn span(&self) -> f32
pub fn db_to_linear(db: f32) -> f32
Sourcepub fn linear_to_db(linear: f32) -> f32
pub fn linear_to_db(linear: f32) -> f32
Returns -inf for amplitude <= 0.
Trait Implementations§
Source§impl Clone for ParameterRange
impl Clone for ParameterRange
Source§fn clone(&self) -> ParameterRange
fn clone(&self) -> ParameterRange
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ParameterRange
impl Debug for ParameterRange
Auto Trait Implementations§
impl Freeze for ParameterRange
impl RefUnwindSafe for ParameterRange
impl Send for ParameterRange
impl Sync for ParameterRange
impl Unpin for ParameterRange
impl UnsafeUnpin for ParameterRange
impl UnwindSafe for ParameterRange
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