Trait sample::Sample [] [src]

pub trait Sample: Copy + Clone + Default + Debug + PartialOrd + PartialEq + Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + Div<Output=Self> + Rem<Output=Self> {
    fn from_wave(Wave) -> Self;
    fn to_wave(self) -> Wave;

    fn mul_amp(self, amp: f32) -> Self { ... }
    fn from_sample<S: Sample>(sample: S) -> Self { ... }
    fn to_sample<S: Sample>(self) -> S { ... }
    fn zero() -> Self { ... }
}

A trait for working generically across different sample types.

Required Methods

fn from_wave(Wave) -> Self

Construct a sample from a wave sample between -1. and 1.

fn to_wave(self) -> Wave

Convert to a wave sample between -1. and 1.

Provided Methods

fn mul_amp(self, amp: f32) -> Self

Multiply by a given amplitude.

fn from_sample<S: Sample>(sample: S) -> Self

Construct a sample from an arbitrary Sample type.

fn to_sample<S: Sample>(self) -> S

Construct an arbitrary sample type from a sample of this Self type.

fn zero() -> Self

A silent sample.

Implementors