Struct sampler::map::Map [] [src]

pub struct Map<A> {
    pub pairs: Vec<SampleOverRange<A>>,
}

A type that maps frequncy and velocity ranges to audio samples.

Fields

pairs: Vec<SampleOverRange<A>>

Methods

impl<A> Map<A> where A: Audio
[src]

fn empty() -> Self

Construct an empty Map.

fn from_sequential_mappings<I>(mappings: I) -> Self where I: IntoIterator<Item=(Hz, Velocity, Sample<A>)>

Construct a Map from a series of mappings, starting from (-C2, 1.0).

fn from_single_sample(sample: Sample<A>) -> Self

Creates a Map with a single sample mapped to the entire Hz and Velocity range.

fn insert(&mut self, range: HzVelRange, sample: Sample<A>)

Inserts a range -> audio mapping into the Map.

fn sample(&self, hz: Hz, vel: Velocity) -> Option<Sample<A>>

Returns the Audio associated with the range within which the given hz and velocity exist.

TODO: This would probably be quicker with some sort of specialised RangeMap.

Trait Implementations

impl<A: PartialEq> PartialEq for Map<A>
[src]

fn eq(&self, __arg_0: &Map<A>) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Map<A>) -> bool

This method tests for !=.

impl<A: Debug> Debug for Map<A>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<A: Clone> Clone for Map<A>
[src]

fn clone(&self) -> Map<A>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more