pub struct LFO<T: Transcendental> { /* private fields */ }Expand description
LFO генератор (Low Frequency Oscillator)
Генерирует низкочастотные сигналы для модуляции параметров. Частотный диапазон: 0.01 Hz - 100 Hz.
§Режимы работы
- Биполярный: выходной сигнал в диапазоне [-1, 1]
- Униполярный: выходной сигнал в диапазоне [0, 1]
§Пример
use rill_core::time::ClockTick;
use rill_core::traits::ActionContext;
use rill_core_dsp::generators::*;
use rill_core_dsp::Algorithm;
let tick = ClockTick::default();
let ctx = ActionContext::new(&tick);
// Создаём LFO для модуляции частоты фильтра
let mut lfo = LFO::<f32>::new(
5.0, // 5 Hz
Waveform::Sine,
true // биполярный режим (-1..1)
);
lfo.init(44100.0);
// Генерируем модуляционный сигнал
let mut output = [0.0_f32];
lfo.process(None, &mut output, &ctx).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
Создать новый LFO
§Arguments
frequency- частота в Hz (0.01 - 100)waveform- форма волныbipolar- true для биполярного режима (-1..1), false для униполярного (0..1)
Sourcepub fn with_phase_offset(self, offset: T) -> Self
pub fn with_phase_offset(self, offset: T) -> Self
Создать LFO с фазовым смещением
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)
Установить смещение фазы (0..1)
Позволяет сдвинуть фазу LFO относительно опорной точки. Полезно для создания стерео эффектов или синхронизации нескольких LFO.
Sourcepub fn phase_offset(&self) -> T
pub fn phase_offset(&self) -> T
Получить текущее смещение фазы
Sourcepub fn is_bipolar(&self) -> bool
pub fn is_bipolar(&self) -> bool
Проверить, работает ли LFO в биполярном режиме
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],
_ctx: &ActionContext<'_>,
) -> ProcessResult<()>
fn process( &mut self, input: Option<&[T]>, output: &mut [T], _ctx: &ActionContext<'_>, ) -> ProcessResult<()>
Process one block of audio. 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: 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)
Установить частоту
Source§fn set_amplitude(&mut self, amp: T)
fn set_amplitude(&mut self, amp: T)
Установить амплитуду
Source§fn reset_phase(&mut self)
fn reset_phase(&mut self)
Сбросить фазу в 0
Source§impl<T: Transcendental> SyncableGenerator<T> for LFO<T>
impl<T: Transcendental> SyncableGenerator<T> for LFO<T>
impl<T: Copy + Transcendental> Copy for LFO<T>
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