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) -> Self
Oscillator constructor.
fn waveform(self, waveform: W) -> Self
Waveform builder method.
fn amplitude(self, amplitude: A) -> Self
Amplitude envelope builder method.
fn frequency(self, frequency: F) -> Self
Amplitude envelope builder method.
fn amp_at(&self, phase: f64, playhead_perc: f64) -> f32 where
A: Amplitude,
W: Waveform,
A: Amplitude,
W: Waveform,
Calculate and return the amplitude at the given ratio.
fn next_frame_phase(
&self,
sample_hz: f64,
playhead_perc: f64,
note_freq_multi: f64,
phase: f64,
freq_warp_phase: &mut f64
) -> f64 where
W: Waveform,
F: Frequency,
FW: FreqWarp,
&self,
sample_hz: f64,
playhead_perc: f64,
note_freq_multi: f64,
phase: 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.
fn next_frame_amp(
&mut self,
sample_hz: SampleHz,
playhead_perc: f64,
note_freq_multi: f64,
state: &mut State
) -> f32 where
A: Amplitude,
W: Waveform,
F: Frequency,
FW: FreqWarp,
&mut self,
sample_hz: SampleHz,
playhead_perc: f64,
note_freq_multi: f64,
state: &mut State
) -> f32 where
A: Amplitude,
W: Waveform,
F: Frequency,
FW: FreqWarp,
Steps forward the given phase
and freq_warp_phase
and yields the amplitude for the
next frame.
Trait Implementations
impl<W: Debug, A: Debug, F: Debug, FW: Debug> Debug for Oscillator<W, A, F, FW>
[src]
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: PartialEq, A: PartialEq, F: PartialEq, FW: PartialEq> PartialEq for Oscillator<W, A, F, FW>
[src]
fn eq(&self, __arg_0: &Oscillator<W, A, F, FW>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Oscillator<W, A, F, FW>) -> bool
This method tests for !=
.