pub struct DrumKit { /* private fields */ }Expand description
A playable drum kit: MIDI note → a pre-rendered one-shot.
Implementations§
Source§impl DrumKit
impl DrumKit
Sourcepub fn general_midi(sample_rate: u32) -> Self
pub fn general_midi(sample_rate: u32) -> Self
The General MIDI drum map, synthesized once at sample_rate.
Sourcepub fn with_max_voices(self, max: usize) -> Self
pub fn with_max_voices(self, max: usize) -> Self
Set the polyphony cap — the number of simultaneous hits before the oldest is stolen with a short fade (builder style; default 32, clamped to ≥ 1).
Sourcepub fn note_on(&mut self, note: Note, velocity: f32)
pub fn note_on(&mut self, note: Note, velocity: f32)
Strike the drum mapped to note (velocity scales its level). Notes with no
mapped piece are ignored.
Sourcepub fn active_voices(&self) -> usize
pub fn active_voices(&self) -> usize
Number of drums still ringing.
Trait Implementations§
Source§impl AudioSource for DrumKit
impl AudioSource for DrumKit
Source§fn fill(&mut self, out: &mut [f32]) -> usize
fn fill(&mut self, out: &mut [f32]) -> usize
Fill
out with the next block of interleaved-stereo audio.Source§fn reset(&mut self)
fn reset(&mut self)
Rewind the source to its start (playback position / phase to zero).
Defaults to a no-op; a looping source overrides it so a transport can
restart it from the top.
AdaptiveMusic::reset
calls this on each layer.Auto Trait Implementations§
impl Freeze for DrumKit
impl RefUnwindSafe for DrumKit
impl Send for DrumKit
impl Sync for DrumKit
impl Unpin for DrumKit
impl UnsafeUnpin for DrumKit
impl UnwindSafe for DrumKit
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