39 lines
681 B
Rust
39 lines
681 B
Rust
#[derive(Clone, Copy)]
|
|
pub enum LfoMode {
|
|
FreeRun,
|
|
BpmSync,
|
|
OneShot,
|
|
Envelope,
|
|
}
|
|
|
|
pub struct Lfo {
|
|
pub phase: f32,
|
|
pub rate: f32,
|
|
pub depth: f32,
|
|
pub mode: LfoMode,
|
|
pub wave_pos: f32,
|
|
pub sync: bool,
|
|
sample_rate: f32,
|
|
}
|
|
|
|
impl Lfo {
|
|
pub fn new(sr: f32) -> Self {
|
|
Self {
|
|
phase: 0.0,
|
|
rate: 1.0,
|
|
depth: 1.0,
|
|
mode: LfoMode::FreeRun,
|
|
wave_pos: 0.0,
|
|
sync: false,
|
|
sample_rate: sr,
|
|
}
|
|
}
|
|
pub fn retrigger(&mut self) {
|
|
self.phase = 0.0;
|
|
}
|
|
#[inline]
|
|
pub fn tick(&mut self, _host_bpm: f32) -> f32 {
|
|
0.0
|
|
}
|
|
}
|