Lfo

Struct Lfo 

Source
pub struct Lfo { /* private fields */ }
Expand description

An Lfo (Low-frequency oscillation) is used to modulate sounds in a Synth with a function.

Implementations§

Source§

impl Lfo

Source

pub fn new_with_fixed_function( lfo_type: LfoFixedFunction, rate: f32, phase: f32, center: f32, depth: f32, ) -> Self

Constructs a new LFO with the given shape. See set_fixed_function().

Source

pub fn new_with_arpeggiation(steps: &[f32]) -> Self

Constructs a new LFO with an arpeggio. See set_arpeggiation().

Source

pub fn new_with_user_function( &mut self, interpolate: bool, f: impl FnMut() -> f32 + Send + 'static, ) -> Self

Constructs a new LFO with a custom function. See set_user_function().

Source

pub fn set_fixed_function( &mut self, lfo_type: LfoFixedFunction, rate: f32, phase: f32, center: f32, depth: f32, )

Sets the LFO to the given fixed function shape.

The rate is in cycles per second.

Source

pub fn set_arpeggiation(&mut self, steps: &[f32])

Sets the LFO type to arpeggio, where the given values are in half-steps from the center note.

For example, the sequence (0, 4, 7, 12) plays the notes of a major chord.

Source

pub fn set_user_function( &mut self, interpolate: bool, f: impl FnMut() -> f32 + Send + 'static, )

Provides a custom function for LFO values.

TODO: What does interpolate mean for this function?

Source

pub fn set_delay(&mut self, holdoff: TimeTicks, ramp_time: TimeTicks)

Sets an initial holdoff time for the LFO where the LFO remains at its center value, and a ramp time where the value increases linearly to its maximum depth.

Source

pub fn set_retrigger(&mut self, retrigger: bool)

If retrigger is on, the LFO’s phase is reset to 0 when a synth using the LFO starts playing a note.

Source

pub fn set_global(&mut self, global: bool)

If global is set, the LFO is continuously updated whether or not it’s currently in use.

Source

pub fn get_value(&self) -> f32

Return the current output value of the LFO.

Trait Implementations§

Source§

impl AsMut<SynthSignal> for Lfo

Source§

fn as_mut(&mut self) -> &mut SynthSignal

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<SynthSignal> for Lfo

Source§

fn as_ref(&self) -> &SynthSignal

Converts this type into a shared reference of the (usually inferred) input type.

Auto Trait Implementations§

§

impl Freeze for Lfo

§

impl !RefUnwindSafe for Lfo

§

impl !Send for Lfo

§

impl !Sync for Lfo

§

impl Unpin for Lfo

§

impl !UnwindSafe for Lfo

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsSynthSignal for T

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.