pub struct LFO<T: Transcendental> { /* private fields */ }Expand description
LFO (Low Frequency Oscillator)
Generates low-frequency signals for parameter modulation. Frequency range: 0.01 Hz - 100 Hz.
§Operating modes
- Bipolar: output in range [-1, 1]
- Unipolar: output in range [0, 1]
§Example
use rill_core::time::ClockTick;
use rill_core::traits::ActionContext;
use rill_core_dsp::generators::*;
use rill_core::traits::algorithm::Algorithm;
let tick = ClockTick::default();
let ctx = ActionContext::new(&tick);
// Create LFO for filter frequency modulation
let mut lfo = LFO::<f32>::new(
5.0, // 5 Hz
Waveform::Sine,
true // bipolar mode (-1..1)
);
lfo.init(44100.0);
// Generate modulation signal
let mut output = [0.0_f32];
lfo.process(None, &mut output).unwrap();
let modulation = output[0];Implementations§
Source§impl<T: Transcendental> LFO<T>
impl<T: Transcendental> LFO<T>
Sourcepub fn new(frequency: f32, waveform: Waveform, bipolar: bool) -> Self
pub fn new(frequency: f32, waveform: Waveform, bipolar: bool) -> Self
Create a new LFO
§Arguments
frequency- frequency in Hz (0.01 - 100)waveform- waveform shapebipolar- true for bipolar (-1..1), false for unipolar (0..1)
Sourcepub fn with_phase_offset(self, offset: T) -> Self
pub fn with_phase_offset(self, offset: T) -> Self
Create an LFO with phase offset
Sourcepub fn set_bipolar(&mut self, bipolar: bool)
pub fn set_bipolar(&mut self, bipolar: bool)
Sourcepub fn set_phase_offset(&mut self, offset: T)
pub fn set_phase_offset(&mut self, offset: T)
Set phase offset (0..1)
Shifts the LFO phase relative to the reference point. Useful for stereo effects or synchronizing multiple LFOs.
Sourcepub fn phase_offset(&self) -> T
pub fn phase_offset(&self) -> T
Get current phase offset
Sourcepub fn is_bipolar(&self) -> bool
pub fn is_bipolar(&self) -> bool
Check if LFO is in bipolar mode
Trait Implementations§
Source§impl<T: Transcendental> Algorithm<T> for LFO<T>
impl<T: Transcendental> Algorithm<T> for LFO<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
impl<T: Copy + Transcendental> Copy for LFO<T>
Source§impl<T: Transcendental> Generator<T> for LFO<T>
impl<T: Transcendental> Generator<T> for LFO<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
Auto Trait Implementations§
impl<T> Freeze for LFO<T>where
T: Freeze,
impl<T> RefUnwindSafe for LFO<T>where
T: RefUnwindSafe,
impl<T> Send for LFO<T>
impl<T> Sync for LFO<T>
impl<T> Unpin for LFO<T>where
T: Unpin,
impl<T> UnsafeUnpin for LFO<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for LFO<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