pub struct EnvelopeAutomaton { /* private fields */ }Expand description
An envelope automaton that generates time-varying control signals.
The envelope progresses through stages (Attack, Decay, Sustain, Release, etc.) and outputs a value that can be mapped to a parameter. The stage curve controls the shape: 1.0 = linear, >1.0 = exponential, <1.0 = logarithmic.
Implementations§
Source§impl EnvelopeAutomaton
impl EnvelopeAutomaton
Sourcepub fn adsr(
name: &str,
attack: f64,
decay: f64,
sustain: f64,
release: f64,
) -> Self
pub fn adsr( name: &str, attack: f64, decay: f64, sustain: f64, release: f64, ) -> Self
Create a new ADSR envelope.
Sourcepub fn ar(name: &str, attack: f64, release: f64) -> Self
pub fn ar(name: &str, attack: f64, release: f64) -> Self
Create a new AR envelope (suitable for percussion).
Sourcepub fn asr(name: &str, attack: f64, sustain: f64, release: f64) -> Self
pub fn asr(name: &str, attack: f64, sustain: f64, release: f64) -> Self
Create a new ASR envelope (suitable for organ sounds).
Sourcepub fn ahdsr(
name: &str,
attack: f64,
hold: f64,
decay: f64,
sustain: f64,
release: f64,
) -> Self
pub fn ahdsr( name: &str, attack: f64, hold: f64, decay: f64, sustain: f64, release: f64, ) -> Self
Create a new AHDSR envelope with an additional hold stage.
Sourcepub fn with_curve(self, curve: f64) -> Self
pub fn with_curve(self, curve: f64) -> Self
Set the stage curve exponent (1.0 = linear).
Sourcepub fn with_range(self, range: Range) -> Self
pub fn with_range(self, range: Range) -> Self
Set the output range.
Trait Implementations§
Source§impl Automaton for EnvelopeAutomaton
impl Automaton for EnvelopeAutomaton
Source§type Internal = (EnvelopeStage, f64, f64)
type Internal = (EnvelopeStage, f64, f64)
The automaton’s internal state, carried across step invocations.
Source§type Action = EnvelopeAction
type Action = EnvelopeAction
An optional action type driving state transitions on each step.
Source§fn step(
&self,
internal: &mut Self::Internal,
current: &ParamValue,
time: Time,
action: &Self::Action,
) -> ParamValue
fn step( &self, internal: &mut Self::Internal, current: &ParamValue, time: Time, action: &Self::Action, ) -> ParamValue
Advances the automaton by one step, producing a new output value. Read more
Source§fn initial_internal(&self) -> Self::Internal
fn initial_internal(&self) -> Self::Internal
Returns the automaton’s initial internal state (at time zero).
Source§impl Clone for EnvelopeAutomaton
impl Clone for EnvelopeAutomaton
Source§fn clone(&self) -> EnvelopeAutomaton
fn clone(&self) -> EnvelopeAutomaton
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 moreAuto Trait Implementations§
impl Freeze for EnvelopeAutomaton
impl RefUnwindSafe for EnvelopeAutomaton
impl Send for EnvelopeAutomaton
impl Sync for EnvelopeAutomaton
impl Unpin for EnvelopeAutomaton
impl UnsafeUnpin for EnvelopeAutomaton
impl UnwindSafe for EnvelopeAutomaton
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