[][src]Struct iced_audio::core::param::OctaveParam

pub struct OctaveParam<ID: Debug + Copy + Clone> { /* fields omitted */ }

A Param that defines a continuous logarithmic range of f32 frequency values, with each octave in the 10 octave spectrum spaced evenly.

Smaller frequencies will increment slower per slider movement than larger ones.

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> OctaveParam<ID>[src]

pub fn new(id: ID, min: f32, max: f32, value: f32, default_value: f32) -> Self[src]

Creates a new OctaveParam

Arguments

  • id - an identifier for the parameter (must be unique!)
  • min - the minimum of the range in Hz (inclusive), will be constrained to 20.0 Hz <= min <= 20480.0 Hz
  • max - the maximum of the range in Hz (inclusive), will be constrained to 20.0 Hz <= max <= 20480.0 Hz
  • value - the initial value of the parameter in Hz (if value falls outside the range given by min and max, then min or max will be used instead)
  • default_value - the default value of the parameter in Hz (if default_value falls outside the range given by min and max, then min or max will be used instead)

Panics

This will panic if

  • max <= min

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 frequency value

pub fn normal_to_value(&self, normal: Normal) -> f32[src]

Returns the corresponding frequency value from the supplied Normal

Trait Implementations

impl<ID: Clone + Debug + Copy> Clone for OctaveParam<ID>[src]

impl<ID: Copy + Debug + Clone> Copy for OctaveParam<ID>[src]

impl<ID: Debug + Copy + Clone> Debug for OctaveParam<ID>[src]

impl<ID: Debug + Copy + Clone> Param for OctaveParam<ID>[src]

type ID = ID

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! Read more

Auto Trait Implementations

impl<ID> RefUnwindSafe for OctaveParam<ID> where
    ID: RefUnwindSafe

impl<ID> Send for OctaveParam<ID> where
    ID: Send

impl<ID> Sync for OctaveParam<ID> where
    ID: Sync

impl<ID> Unpin for OctaveParam<ID> where
    ID: Unpin

impl<ID> UnwindSafe for OctaveParam<ID> where
    ID: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SetParameter for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,