[−][src]Struct iced_audio::core::param::LogDBParam
A Param
that defines a continuous logarithmic range of dB
values,
with an inflection/stationary point at 0 dB
Values around 0 dB (positive and negative) will increment slower per slider movement than values farther away from 0 dB.
It stores a unique identifier of user supplied type ID
. This can be an
enum
, u32
, i32
, String
, etc. Each parameter must have a unique ID
value!
Implementations
impl<ID: Debug + Copy + Clone> LogDBParam<ID>
[src]
pub fn new(
id: ID,
min: f32,
max: f32,
value: f32,
default_value: f32,
zero_normal: Normal
) -> Self
[src]
id: ID,
min: f32,
max: f32,
value: f32,
default_value: f32,
zero_normal: Normal
) -> Self
Creates a new LogDBParam
Arguments
id
- an identifier for the parameter (must be unique!)min
- the minimum of the range in dB (inclusive), must be <= 0.0max
- the maximum of the range in dB (inclusive), must be >= 0.0value
- the initial value of the parameter in dB (ifvalue
falls outside the range given bymin
andmax
, thenmin
ormax
will be used instead)default_value
- the default value of the parameter in dB (ifdefault_value
falls outside the range given bymin
andmax
, thenmin
ormax
will be used instead)zero_normal
- a normal that defines where on the slider 0 decibels should be. For example,Normal::new(0.5)
will have 0 dB at the center of the slider. Normals of1.0
and0.0
can be used for only negative or only positive decibels respectively
Panics
This will panic if
max
<=min
min
>0.0
max
<0.0
pub fn set_from_value(&mut self, value: f32)
[src]
Sets the parameter's value to value
If value
falls outside the range given by min
and max
from
FloatParam::new()
, then
min
or max
will be used instead.
Value to Normal
calculactions will not be recalculated if the value
has not changed.
pub fn set_from_normal(&mut self, normal: Normal)
[src]
Sets the parameter's value from a Normal
Normal
to value calculactions will not be recalculated if the Normal
has not changed.
pub fn value(&self) -> f32
[src]
Returns the parameter's value
pub fn default_value(&self) -> f32
[src]
Returns the parameter's default value
pub fn value_to_normal(&self, value: f32) -> Normal
[src]
Returns the corresponding Normal
from the supplied value
pub fn normal_to_value(&self, normal: Normal) -> f32
[src]
Returns the corresponding dB value from the supplied Normal
Trait Implementations
impl<ID: Clone + Debug + Copy> Clone for LogDBParam<ID>
[src]
fn clone(&self) -> LogDBParam<ID>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<ID: Copy + Debug + Clone> Copy for LogDBParam<ID>
[src]
impl<ID: Debug + Copy + Clone> Debug for LogDBParam<ID>
[src]
impl<ID: Debug + Copy + Clone> Param for LogDBParam<ID>
[src]
Auto Trait Implementations
impl<ID> RefUnwindSafe for LogDBParam<ID> where
ID: RefUnwindSafe,
ID: RefUnwindSafe,
impl<ID> Send for LogDBParam<ID> where
ID: Send,
ID: Send,
impl<ID> Sync for LogDBParam<ID> where
ID: Sync,
ID: Sync,
impl<ID> Unpin for LogDBParam<ID> where
ID: Unpin,
ID: Unpin,
impl<ID> UnwindSafe for LogDBParam<ID> where
ID: UnwindSafe,
ID: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,