[][src]Trait rodio::Sample

pub trait Sample: CpalSample {
    fn lerp(first: Self, second: Self, numerator: u32, denominator: u32) -> Self;
fn amplify(self, value: f32) -> Self;
fn saturating_add(self, other: Self) -> Self;
fn zero_value() -> Self; }

Represents a value of a single sample.

This trait is implemented by default on three types: i16, u16 and f32.

You can implement this trait on your own type as well if you wish so.

Required methods

fn lerp(first: Self, second: Self, numerator: u32, denominator: u32) -> Self

Linear interpolation between two samples.

The result should be equal to first * numerator / denominator + second * (1 - numerator / denominator).

fn amplify(self, value: f32) -> Self

Multiplies the value of this sample by the given amount.

fn saturating_add(self, other: Self) -> Self

Calls saturating_add on the sample.

fn zero_value() -> Self

Returns the value corresponding to the absence of sound.

Loading content...

Implementations on Foreign Types

impl Sample for u16[src]

impl Sample for i16[src]

impl Sample for f32[src]

Loading content...

Implementors

Loading content...