pub struct Voice {
pub index: usize,
pub state: VoiceState,
pub note: Option<u8>,
pub velocity: f64,
pub voct: f64,
pub gate: f64,
pub trigger: f64,
pub age: u64,
pub release_samples: u64,
pub envelope_level: f64,
}Expand description
A single voice in a polyphonic context
Fields§
§index: usizeVoice index (0 to num_voices - 1)
state: VoiceStateCurrent state
note: Option<u8>MIDI note number currently playing (if any)
velocity: f64Current velocity (0.0 to 1.0)
voct: f64Current V/Oct value
gate: f64Gate signal (0.0 or 1.0)
trigger: f64Trigger signal (momentary; asserted on the note-on sample)
age: u64Age counter (samples since note on)
release_samples: u64Samples elapsed since the gate fell (entering Releasing)
envelope_level: f64Current tracked envelope level (0..~1), populated by PolyPatch from
the voice’s real output amplitude. Drives quiet-steal and release-tail
auto-free decisions.
Implementations§
Source§impl Voice
impl Voice
Sourcepub fn tick(&mut self)
pub fn tick(&mut self)
Advance the voice’s per-sample bookkeeping (age, release counter, clear
the one-sample trigger). Auto-free is handled by VoiceAllocator,
which knows the release threshold and grace period.
Sourcepub fn is_playing_note(&self, note: u8) -> bool
pub fn is_playing_note(&self, note: u8) -> bool
Check if voice is playing the given note
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Voice
impl RefUnwindSafe for Voice
impl Send for Voice
impl Sync for Voice
impl Unpin for Voice
impl UnsafeUnpin for Voice
impl UnwindSafe for Voice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more