pub struct Envelope(/* private fields */);Expand description
An effect envelope.
Effect intensity can be faded in and out by configuring the envelope.
There is no guarantee that any given driver or device will respect these settings.
Fade and attack levels are relative to the magnitude of the modulated effect.
Their maximum value is 0x7fff (higher values are treated the same as 0x7fff), representing
100% of the effect’s intensity.
atk. len. fade len.
|------| |---------|
+---------------+ - - - - - - - effect magnitude/intensity
/ \
/ \
/ \
/ \
/ \
/ \
/ _ \
| | \
| | atk. _ \
| | lvl. fade | |
| | lvl. | |Implementations§
Source§impl Envelope
impl Envelope
Sourcepub fn new() -> Self
pub fn new() -> Self
Returns a zeroed-out default Envelope structure.
This envelope configures no fading: the effect will start at its configured intensity immediately, and end abruptly.
Sourcepub fn with_attack_length(self, ms: u16) -> Self
pub fn with_attack_length(self, ms: u16) -> Self
Effect will be faded in for ms milliseconds before reaching its full intensity.
Sourcepub fn with_attack_level(self, level: u16) -> Self
pub fn with_attack_level(self, level: u16) -> Self
Effect fade-in will start with intensity level.
Sourcepub fn with_fade_length(self, ms: u16) -> Self
pub fn with_fade_length(self, ms: u16) -> Self
Effect will fade out for ms milliseconds before stopping.
Sourcepub fn with_fade_level(self, level: u16) -> Self
pub fn with_fade_level(self, level: u16) -> Self
Effect fade-out will stop at intensity level.