Struct synth::oscillator::Oscillator [] [src]

pub struct Oscillator<W, A, F, FW> {
    pub waveform: W,
    pub amplitude: A,
    pub frequency: F,
    pub freq_warp: FW,
    pub is_muted: bool,
}

The fundamental component of a synthesizer.

Fields

waveform: W

Waveform used for phase movement.

amplitude: A

Envelope for amplitude interpolation.

frequency: F

Envelope for frequency interpolation.

freq_warp: FW

A type used for warping the Oscillator's frequency.

is_muted: bool

Whether or not the Oscillator is currently muted.

Methods

impl<W, A, F, FW> Oscillator<W, A, F, FW>
[src]

fn new(waveform: W, amplitude: A, frequency: F, freq_warp: FW) -> Oscillator<W, A, F, FW>

Oscillator constructor.

fn waveform<WNew>(self, waveform: WNew) -> Oscillator<WNew, A, F, FW>

Waveform builder method.

fn amplitude<ANew>(self, amplitude: ANew) -> Oscillator<W, ANew, F, FW>

Amplitude envelope builder method.

fn frequency<FNew>(self, frequency: FNew) -> Oscillator<W, A, FNew, FW>

Amplitude envelope builder method.

fn amp_at(&self, phase: f64, playhead_perc: f64) -> f32 where A: Amplitude, W: Waveform

Calculate and return the amplitude at the given ratio.

fn next_phase(&self, phase: f64, playhead_perc: f64, note_freq_multi: f64, sample_hz: f64, freq_warp_phase: &mut f64) -> f64 where W: Waveform, F: Frequency, FW: FreqWarp

Calculate and return the phase that should follow some given phase.

Trait Implementations

impl<W: Decodable, A: Decodable, F: Decodable, FW: Decodable> Decodable for Oscillator<W, A, F, FW>
[src]

fn decode<__DWAFFW: Decoder>(__arg_0: &mut __DWAFFW) -> Result<Oscillator<W, A, F, FW>, __DWAFFW::Error>

impl<W: Encodable, A: Encodable, F: Encodable, FW: Encodable> Encodable for Oscillator<W, A, F, FW>
[src]

fn encode<__SWAFFW: Encoder>(&self, __arg_0: &mut __SWAFFW) -> Result<(), __SWAFFW::Error>

impl<W: Clone, A: Clone, F: Clone, FW: Clone> Clone for Oscillator<W, A, F, FW>
[src]

fn clone(&self) -> Oscillator<W, A, F, FW>

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl<W: Debug, A: Debug, F: Debug, FW: Debug> Debug for Oscillator<W, A, F, FW>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.