Struct instrument::Voice
[−]
[src]
pub struct Voice<NF> { pub note: Option<Note<NF>>, pub playhead: Playhead, }
A single Voice. A Synth may consist of any number of Voices.
Fields
note: Option<Note<NF>>
Data for a note, if there is one currently being played.
Playhead
represents the number of frames played since note
became Some
.
playhead: Playhead
Number of frames played since the beginning of the note.
Methods
impl<NF> Voice<NF>
[src]
fn new() -> Self
Constructor for a Voice.
fn reset_playhead(&mut self)
Reset the voice's playheads.
fn note_on(&mut self, hz: NoteHz, freq: NF, vel: NoteVelocity)
Trigger playback with the given note, resetting all playheads.
fn note_off(&mut self)
Release playback of the current not eif there is one.
fn stop(&mut self)
Stop playback of the current note if there is one and reset the playheads.
fn next_vel_hz(
&mut self,
attack: u64,
release: u64
) -> Option<(NoteVelocity, NoteHz)> where
NF: NoteFreq,
&mut self,
attack: u64,
release: u64
) -> Option<(NoteVelocity, NoteHz)> where
NF: NoteFreq,
The velocity and frequency of the voice for the next frame.
Trait Implementations
impl<NF: Clone> Clone for Voice<NF>
[src]
fn clone(&self) -> Voice<NF>
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