Struct Sample

Source
pub struct Sample {
Show 24 fields pub wave_type: WaveType, pub base_freq: f64, pub freq_limit: f64, pub freq_ramp: f64, pub freq_dramp: f64, pub duty: f32, pub duty_ramp: f32, pub vib_strength: f64, pub vib_speed: f64, pub vib_delay: f32, pub env_attack: f32, pub env_sustain: f32, pub env_decay: f32, pub env_punch: f32, pub lpf_resonance: f32, pub lpf_freq: f32, pub lpf_ramp: f32, pub hpf_freq: f32, pub hpf_ramp: f32, pub pha_offset: f32, pub pha_ramp: f32, pub repeat_speed: f32, pub arp_speed: f32, pub arp_mod: f64,
}
Expand description

Defines a sound effect configuration for a Generator

Fields§

§wave_type: WaveType

Oscillator wave type

§base_freq: f64

Oscillator base frequency. Value must be between 0.0 and 1.0.

§freq_limit: f64

Oscillator frequency limit. Value must be between 0.0 and 1.0.

§freq_ramp: f64

Oscillator frequency change over time. Value must be between -1.0 and 1.0.

§freq_dramp: f64

freq_ramp change over time. Value must be between -1.0 and 1.0.

§duty: f32

Oscillator square wave duty cycle. Value must be between 0.0 and 1.0.

§duty_ramp: f32

Oscillator square wave duty cycle change over time. Value must be between -1.0 and 1.0.

§vib_strength: f64

Vibrato strength. Value must be between 0.0 and 1.0.

§vib_speed: f64

Vibrato speed. Value must be between 0.0 and 1.0.

§vib_delay: f32

Vibrato delay. Value must be between 0.0 and 1.0.

§env_attack: f32

Duration of attack envelope. Value must be between 0.0 and 1.0.

§env_sustain: f32

Duration of sustain envelope. Value must be between 0.0 and 1.0.

§env_decay: f32

Duration of decay envelope. Value must be between 0.0 and 1.0.

§env_punch: f32

Amount of “punch” in sustain envelope. Value must be between -1.0 and 1.0.

§lpf_resonance: f32

Low pass filter resonance. Value must be between 0.0 and 1.0.

§lpf_freq: f32

Low pass filter cutoff frequency. Value must be between 0.0 and 1.0.

§lpf_ramp: f32

Low pass filter cutoff frequency change over time. Value must be between -1.0 and 1.0.

§hpf_freq: f32

High pass filter cutoff frequency. Value must be between 0.0 and 1.0.

§hpf_ramp: f32

High pass filter cutoff frequency change over time. Value must be between -1.0 and 1.0.

§pha_offset: f32

Phaser temporal offset. Value must be between -1.0 and 1.0.

§pha_ramp: f32

Phaser temporal offset change over time. Value must be between -1.0 and 1.0.

§repeat_speed: f32

Sample repeat speed. Value must be between 0.0 and 1.0.

§arp_speed: f32

Arpeggio interval. Value must be between 0.0 and 1.0.

§arp_mod: f64

Arpeggio step in frequency. Value must be between -1.0 and 1.0.

Implementations§

Source§

impl Sample

Source

pub fn new() -> Sample

Constructs a new Sample with default settings

Source

pub fn mutate(&mut self, seed: Option<u64>)

Changes Sample fields randomly by a little

Source

pub fn pickup(seed: Option<u64>) -> Sample

Constructs a new random “coin” or “item pickup” style sample using optional random seed

Source

pub fn laser(seed: Option<u64>) -> Sample

Constructs a new random “shoot” or “laser” style sample using optional random seed

Source

pub fn explosion(seed: Option<u64>) -> Sample

Constructs a new random “explosion” style sample using optional random seed

Source

pub fn powerup(seed: Option<u64>) -> Sample

Constructs a new random “powerup” style sample using optional random seed

Source

pub fn hit(seed: Option<u64>) -> Sample

Constructs a new random “hit” or “damage” style sample using optional random seed

Source

pub fn jump(seed: Option<u64>) -> Sample

Constructs a new random “jump” style sample using optional random seed

Source

pub fn blip(seed: Option<u64>) -> Sample

Constructs a new random “blip” or “menu navigation” style sample using optional random seed

Auto Trait Implementations§

§

impl Freeze for Sample

§

impl RefUnwindSafe for Sample

§

impl Send for Sample

§

impl Sync for Sample

§

impl Unpin for Sample

§

impl UnwindSafe for Sample

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.