Struct sampler::Sampler
[−]
[src]
pub struct Sampler<M, NFG, A> where
NFG: NoteFreqGenerator,
A: Audio, { pub instrument: Instrument<M, NFG>, pub map: Map<A>, // some fields omitted }
A Sampler instrument.
Fields
instrument: Instrument<M, NFG>
map: Map<A>
Methods
impl<NFG, A> Sampler<Mono, NFG, A> where
NFG: NoteFreqGenerator,
A: Audio,
[src]
NFG: NoteFreqGenerator,
A: Audio,
impl<NFG, A> Sampler<Mono, NFG, A> where
NFG: NoteFreqGenerator,
A: Audio,
[src]
NFG: NoteFreqGenerator,
A: Audio,
fn retrigger(nfg: NFG, map: Map<A>) -> Self
Construct a Sampler
with a Mono::Retrigger
playback mode.
impl<NFG, A> Sampler<Poly, NFG, A> where
NFG: NoteFreqGenerator,
A: Audio,
[src]
NFG: NoteFreqGenerator,
A: Audio,
impl<M, NFG, A> Sampler<M, NFG, A> where
NFG: NoteFreqGenerator,
A: Audio,
[src]
NFG: NoteFreqGenerator,
A: Audio,
fn new(mode: M, note_freq_gen: NFG, map: Map<A>) -> Self
Construct a new Sampler
.
fn map_instrument<Map, NewM, NewNFG>(self, f: Map) -> Sampler<NewM, NewNFG, A> where
Map: FnOnce(Instrument<M, NFG>) -> Instrument<NewM, NewNFG>,
NewNFG: NoteFreqGenerator,
Map: FnOnce(Instrument<M, NFG>) -> Instrument<NewM, NewNFG>,
NewNFG: NoteFreqGenerator,
Map the Instrument
to a new Instrument
in place.
This is useful for providing wrapper builder methods for the Synth.
fn num_voices(self, n: usize) -> Self
Build the Sampler
with the given number of voices.
fn voice_count(&self) -> usize
Return the number of voices for use within the Sampler
.
fn detune(self, detune: f32) -> Self
Detune the note_on
hz by the given amount.
fn attack<Attack>(self, attack: Attack) -> Self where
Attack: Into<Ms>,
Attack: Into<Ms>,
Set the attack.
fn release<Release>(self, release: Release) -> Self where
Release: Into<Ms>,
Release: Into<Ms>,
Set the release.
fn set_num_voices(&mut self, n: usize)
Set the number of voices to use for
fn note_on<T>(&mut self, note_hz: T, note_vel: Velocity) where
M: Mode + Mode,
T: Into<Hz>,
M: Mode + Mode,
T: Into<Hz>,
Begin playback of a note.
fn note_off<T>(&mut self, note_hz: T) where
M: Mode + Mode,
T: Into<Hz>,
M: Mode + Mode,
T: Into<Hz>,
Stop playback of the note that was triggered with the matching frequency.
fn stop(&mut self) where
M: Mode,
M: Mode,
Stop playback and clear the current notes.
fn frames(&mut self, sample_hz: f64) -> Frames<A, NFG::NoteFreq> where
A: Audio,
<A::Frame as Frame>::Sample: Duplex<f64>,
<<A::Frame as Frame>::Sample as PcmSample>::Float: FromSample<f32>,
A: Audio,
<A::Frame as Frame>::Sample: Duplex<f64>,
<<A::Frame as Frame>::Sample as PcmSample>::Float: FromSample<f32>,
Produces an iterator that yields Frame
s of audio data.
fn is_active(&self) -> bool
Returns whether or not the Sampler
is currently playing any notes.
fn fill_slice<F>(&mut self, output: &mut [F], sample_hz: f64) where
F: Frame,
F::Sample: Duplex<f64>,
<F::Sample as PcmSample>::Float: FromSample<f32>,
A: Audio<Frame = F>,
F: Frame,
F::Sample: Duplex<f64>,
<F::Sample as PcmSample>::Float: FromSample<f32>,
A: Audio<Frame = F>,
Fills the given slice of frames with the Sampler::frames
iterator.
Trait Implementations
impl<M: Clone, NFG: Clone, A: Clone> Clone for Sampler<M, NFG, A> where
NFG: NoteFreqGenerator,
A: Audio,
[src]
NFG: NoteFreqGenerator,
A: Audio,
fn clone(&self) -> Sampler<M, NFG, 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
impl<M: Debug, NFG: Debug, A: Debug> Debug for Sampler<M, NFG, A> where
NFG: NoteFreqGenerator,
A: Audio,
[src]
NFG: NoteFreqGenerator,
A: Audio,