# Enum nih_plug::params::range::FloatRange

source · ```
pub enum FloatRange {
Linear {
min: f32,
max: f32,
},
Skewed {
min: f32,
max: f32,
factor: f32,
},
SymmetricalSkewed {
min: f32,
max: f32,
factor: f32,
center: f32,
},
Reversed(&'static FloatRange),
}
```

## Expand description

A distribution for a floating point parameter’s range. All range endpoints are inclusive.

## Variants§

### Linear

The values are uniformly distributed between `min`

and `max`

.

### Skewed

The range is skewed by a factor. Values above 1.0 will make the end of the range wider,
while values between 0 and 1 will skew the range towards the start. Use
`FloatRange::skew_factor()`

for a more intuitively way to calculate the skew factor where
positive values skew the range towards the end while negative values skew the range toward
the start.

### SymmetricalSkewed

The same as `FloatRange::Skewed`

, but with the skewing happening from a central point.
This central point is rescaled to be at 50% of the parameter’s range for convenience of use.
Git blame this comment to find a version that doesn’t do this.

### Reversed(&'static FloatRange)

A reversed range that goes from high to low instead of from low to high.

## Implementations§

source§### impl FloatRange

### impl FloatRange

source#### pub fn skew_factor(factor: f32) -> f32

#### pub fn skew_factor(factor: f32) -> f32

Calculate a skew factor for `FloatRange::Skewed`

and `FloatRange::SymmetricalSkewed`

.
Positive values make the end of the range wider while negative make the start of the range
wider.

source#### pub fn gain_skew_factor(min_db: f32, max_db: f32) -> f32

#### pub fn gain_skew_factor(min_db: f32, max_db: f32) -> f32

Calculate a skew factor for `FloatRange::Skewed`

that makes a linear gain parameter range
appear as if it was linear when formatted as decibels.

source#### pub fn normalize(&self, plain: f32) -> f32

#### pub fn normalize(&self, plain: f32) -> f32

Normalize a plain, unnormalized value. Will be clamped to the bounds of the range if the
normalized value exceeds `[0, 1]`

.

source#### pub fn unnormalize(&self, normalized: f32) -> f32

#### pub fn unnormalize(&self, normalized: f32) -> f32

Unnormalize a normalized value. Will be clamped to `[0, 1]`

if the plain, unnormalized value
would exceed that range.

source#### pub fn previous_step(
&self,
from: f32,
step_size: Option<f32>,
finer: bool
) -> f32

#### pub fn previous_step( &self, from: f32, step_size: Option<f32>, finer: bool ) -> f32

The range’s previous discrete step from a certain value with a certain step size. If the
step size is not set, then the normalized range is split into 50 segments instead. If
`finer`

is true, then this is upped to 200 segments.

source#### pub fn next_step(&self, from: f32, step_size: Option<f32>, finer: bool) -> f32

#### pub fn next_step(&self, from: f32, step_size: Option<f32>, finer: bool) -> f32

The range’s next discrete step from a certain value with a certain step size. If the step size is not set, then the normalized range is split into 100 segments instead.

source#### pub fn snap_to_step(&self, value: f32, step_size: f32) -> f32

#### pub fn snap_to_step(&self, value: f32, step_size: f32) -> f32

Snap a value to a step size, clamping to the minimum and maximum value of the range.

## Trait Implementations§

source§### impl Clone for FloatRange

### impl Clone for FloatRange

source§#### fn clone(&self) -> FloatRange

#### fn clone(&self) -> FloatRange

1.0.0 · source§#### fn clone_from(&mut self, source: &Self)

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

`source`

. Read more