pub struct EnvelopeGenerator<T: Transcendental> { /* private fields */ }Expand description
Multi-stage envelope generator (ADSR, AR, ASR).
Processes an audio-rate gate signal: values > 0.5 trigger the attack phase, values ≤ 0.5 trigger the release phase. Output ramps smoothly between stages.
Implementations§
Source§impl<T: Transcendental> EnvelopeGenerator<T>
impl<T: Transcendental> EnvelopeGenerator<T>
Sourcepub fn adsr(attack: f32, decay: f32, sustain: T, release: f32) -> Self
pub fn adsr(attack: f32, decay: f32, sustain: T, release: f32) -> Self
Create a new ADSR envelope.
attack— attack time in seconds.decay— decay time in seconds.sustain— sustain level (0..1).release— release time in seconds.
Sourcepub fn ar(attack: f32, release: f32) -> Self
pub fn ar(attack: f32, release: f32) -> Self
Create a new AR (Attack-Release) envelope for percussive sounds.
Sourcepub fn asr(attack: f32, sustain: T, release: f32) -> Self
pub fn asr(attack: f32, sustain: T, release: f32) -> Self
Create a new ASR (Attack-Sustain-Release) envelope for organ-like sounds.
Sourcepub fn stage(&self) -> EnvelopeStage
pub fn stage(&self) -> EnvelopeStage
Current envelope stage.
Trait Implementations§
Source§impl<T: Transcendental> Algorithm<T> for EnvelopeGenerator<T>
impl<T: Transcendental> Algorithm<T> for EnvelopeGenerator<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: Transcendental> Generator<T> for EnvelopeGenerator<T>
impl<T: Transcendental> Generator<T> for EnvelopeGenerator<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 EnvelopeGenerator<T>where
T: Freeze,
impl<T> RefUnwindSafe for EnvelopeGenerator<T>where
T: RefUnwindSafe,
impl<T> Send for EnvelopeGenerator<T>
impl<T> Sync for EnvelopeGenerator<T>
impl<T> Unpin for EnvelopeGenerator<T>where
T: Unpin,
impl<T> UnsafeUnpin for EnvelopeGenerator<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for EnvelopeGenerator<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