[][src]Struct sfxr::Generator

pub struct Generator {
    pub sample: Sample,
    pub volume: f32,
    // some fields omitted
}

Sound effect generator

Generates sound effect data according to a Sample into a buffer. The data can be generated in multiple chunks, as the generator maintains its state from one call to generate to the next.

Fields

sample: Sample

Generator settings

volume: f32

Sound effect volume. Default is 0.2.

Methods

impl Generator[src]

pub fn new(s: Sample) -> Generator[src]

Constructs a new Generator based on the provided Sample

pub fn generate(&mut self, buffer: &mut [f32])[src]

Fills buffer with sound effect data. Subsequent calls continue where the last left off. Call reset first to start generating from the beginning.

pub fn reset(&mut self)[src]

Resets the generator to the beginning of the sound effect.

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]