pub struct BasicOscillator<T: Transcendental> { /* private fields */ }Expand description
Basic oscillator
Generates various waveforms with support for:
- Real-time frequency changes
- Frequency modulation (FM)
- Anti-aliasing for sawtooth wave
- Phase synchronization
Implementations§
Source§impl<T: Transcendental> BasicOscillator<T>
impl<T: Transcendental> BasicOscillator<T>
Sourcepub fn new(waveform: Waveform, frequency: f32, amplitude: T) -> Self
pub fn new(waveform: Waveform, frequency: f32, amplitude: T) -> Self
Create a new oscillator
§Arguments
waveform- waveform shapefrequency- frequency in Hzamplitude- amplitude (0.0 - 1.0)
Sourcepub fn reset_phase(&mut self)
pub fn reset_phase(&mut self)
Reset phase to 0
Sourcepub fn current_phase(&self) -> T
pub fn current_phase(&self) -> T
Get current phase (0..1)
Sourcepub fn period_count(&self) -> u32
pub fn period_count(&self) -> u32
Get number of completed periods
Sourcepub fn set_pulse_width(&mut self, width: f32)
pub fn set_pulse_width(&mut self, width: f32)
Set pulse width (for Pulse waveform)
Trait Implementations§
Source§impl<T: Transcendental> Algorithm<T> for BasicOscillator<T>
impl<T: Transcendental> Algorithm<T> for BasicOscillator<T>
Source§fn process(
&mut self,
_input: Option<&[T]>,
output: &mut [T],
) -> ProcessResult<()>
fn process( &mut self, _input: Option<&[T]>, output: &mut [T], ) -> ProcessResult<()>
Process one block of signal. Read more
Source§fn metadata(&self) -> AlgorithmMetadata
fn metadata(&self) -> AlgorithmMetadata
Descriptive metadata (defaults to empty).
Source§fn apply_command(&mut self, _value: T)
fn apply_command(&mut self, _value: T)
Receive a real-time command value from the control path. Read more
Source§impl<T: Clone + Transcendental> Clone for BasicOscillator<T>
impl<T: Clone + Transcendental> Clone for BasicOscillator<T>
Source§fn clone(&self) -> BasicOscillator<T>
fn clone(&self) -> BasicOscillator<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T: Copy + Transcendental> Copy for BasicOscillator<T>
Source§impl<T: Transcendental> Generator<T> for BasicOscillator<T>
impl<T: Transcendental> Generator<T> for BasicOscillator<T>
Source§fn set_frequency(&mut self, freq: f32)
fn set_frequency(&mut self, freq: f32)
Set frequency
Source§fn set_amplitude(&mut self, amp: T)
fn set_amplitude(&mut self, amp: T)
Set amplitude
Source§fn reset_phase(&mut self)
fn reset_phase(&mut self)
Reset phase to 0
Source§impl<T: Transcendental> ModulatableGenerator<T> for BasicOscillator<T>
impl<T: Transcendental> ModulatableGenerator<T> for BasicOscillator<T>
Source§fn modulate_frequency(&mut self, amount: T)
fn modulate_frequency(&mut self, amount: T)
Apply frequency modulation Read more
Source§fn modulation_index(&self) -> T
fn modulation_index(&self) -> T
Modulation index (current FM amount)
Source§fn set_modulation_index(&mut self, index: T)
fn set_modulation_index(&mut self, index: T)
Set modulation index
Source§impl<T: Transcendental> ParameterWrite for BasicOscillator<T>
impl<T: Transcendental> ParameterWrite for BasicOscillator<T>
Source§fn write_parameter(
&mut self,
name: &str,
value: ParamValue,
) -> ProcessResult<()>
fn write_parameter( &mut self, name: &str, value: ParamValue, ) -> ProcessResult<()>
Write a named parameter value. Read more
Source§fn read_parameter(&self, name: &str) -> Option<ParamValue>
fn read_parameter(&self, name: &str) -> Option<ParamValue>
Read a named parameter value. Read more
Source§impl<T: Transcendental> SyncableGenerator<T> for BasicOscillator<T>
impl<T: Transcendental> SyncableGenerator<T> for BasicOscillator<T>
Auto Trait Implementations§
impl<T> Freeze for BasicOscillator<T>where
T: Freeze,
impl<T> RefUnwindSafe for BasicOscillator<T>where
T: RefUnwindSafe,
impl<T> Send for BasicOscillator<T>
impl<T> Sync for BasicOscillator<T>
impl<T> Unpin for BasicOscillator<T>where
T: Unpin,
impl<T> UnsafeUnpin for BasicOscillator<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for BasicOscillator<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more