pub struct SamplerNode { /* private fields */ }Expand description
A polyphonic sampler node.
Implementations§
Source§impl SamplerNode
impl SamplerNode
pub fn new(sample_rate: f32) -> Self
Sourcepub fn midi_queue(&self) -> Arc<Mutex<Vec<MidiEvent>>>
pub fn midi_queue(&self) -> Arc<Mutex<Vec<MidiEvent>>>
Get the MIDI queue for pushing events from the MIDI/control thread.
Sourcepub fn instrument_slot(&self) -> Arc<ArcSwap<Option<LoadedInstrument>>>
pub fn instrument_slot(&self) -> Arc<ArcSwap<Option<LoadedInstrument>>>
Get the instrument slot.
Control thread: call .store(Arc::new(Some(loaded))) to swap in a new instrument.
This is a single atomic store — the RT thread sees the new instrument on the
next process() call without any locking.
Sourcepub fn instrument_slot_mutex(&self) -> Arc<Mutex<Option<LoadedInstrument>>>
pub fn instrument_slot_mutex(&self) -> Arc<Mutex<Option<LoadedInstrument>>>
Compatibility shim: returns an Arc<Mutex<Option.lock().unwrap() = Some(loaded)
still compiles. The write goes through a thin Mutex wrapper that immediately
stores into the ArcSwap.
pub fn reset_round_robin(&mut self)
Trait Implementations§
Source§impl DspNode for SamplerNode
impl DspNode for SamplerNode
Source§fn process(
&mut self,
_inputs: &[Option<&[f32; 64]>; 8],
output: &mut [f32; 64],
_params: &mut ParamBlock,
_sample_rate: f32,
)
fn process( &mut self, _inputs: &[Option<&[f32; 64]>; 8], output: &mut [f32; 64], _params: &mut ParamBlock, _sample_rate: f32, )
Process one buffer of audio. Read more
Source§fn capture_state(&self) -> StateBlob
fn capture_state(&self) -> StateBlob
Capture internal state for continuity transfer.
Source§fn restore_state(&mut self, _state: StateBlob)
fn restore_state(&mut self, _state: StateBlob)
Restore internal state after a graph mutation.
Auto Trait Implementations§
impl Freeze for SamplerNode
impl RefUnwindSafe for SamplerNode
impl Send for SamplerNode
impl Sync for SamplerNode
impl Unpin for SamplerNode
impl UnsafeUnpin for SamplerNode
impl UnwindSafe for SamplerNode
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more