pub struct RtControl { /* private fields */ }Expand description
A Send handle for pushing MIDI and parameter changes to a RealtimePluginRunner
without locking. The runner lives on the audio thread; this handle may move between threads,
but plugin teardown is serviced only on the thread where RealtimePluginRunner::new created
it.
Implementations§
Source§impl RtControl
impl RtControl
Sourcepub fn service_teardown(&mut self) -> bool
pub fn service_teardown(&mut self) -> bool
Destroy a plugin handed back by a dropped RealtimePluginRunner.
This call never waits for the runner. It returns true only when a pending plugin was
destroyed. It must be called on the thread where RealtimePluginRunner::new created
this control; calls from any other thread return false and leave the handoff queued.
Dropping RtControl on its creation thread services any pending handoff automatically.
Dropping it elsewhere deliberately leaks a pending plugin rather than releasing COM
objects and unloading the plugin bundle on the wrong thread.
Sourcepub fn send_midi(&mut self, event: MidiEvent) -> bool
pub fn send_midi(&mut self, event: MidiEvent) -> bool
Queue a MIDI event for the next block (at block start). Returns false if the command
queue is full (the event is dropped rather than blocking the caller).
Sourcepub fn send_midi_at(&mut self, event: MidiEvent, sample_offset: i32) -> bool
pub fn send_midi_at(&mut self, event: MidiEvent, sample_offset: i32) -> bool
Queue a MIDI event scheduled at sample_offset samples into the next block, for
sample-accurate sequencing. A negative offset is floored to 0; process() clamps it
into the actual (possibly shorter) block. Returns false if the queue is full.
Sourcepub fn set_parameter(&mut self, id: u32, value: f64) -> bool
pub fn set_parameter(&mut self, id: u32, value: f64) -> bool
Queue a normalized parameter change for the next block. value must be finite and
within 0.0..=1.0; an invalid value is rejected here (returns false) rather than
queued, so the caller learns about it instead of the audio thread silently discarding
it. Returns false if the queue is full.
§The editor catches up later
The audio thread applies the value to the plugin’s DSP, but IEditController belongs to
the main-thread domain, so the plugin’s own editor (and
Plugin::get_parameter,
format_parameter and saved state) is updated from
the control thread instead. That happens the next time the control thread touches the
plugin — reading a parameter, draining
Plugin::get_parameter_changes, or calling
Plugin::service_host_requests. A host that
polls the plugin every UI frame (the usual editor loop) never notices the gap; a host
that never calls back in will see a stale editor. The queue is bounded and drops its
oldest entry when full, so the newest value for a parameter always wins.
Sourcepub fn set_tempo(&mut self, bpm: f64) -> bool
pub fn set_tempo(&mut self, bpm: f64) -> bool
Queue a transport tempo change (BPM) for the next block. bpm must be finite and
greater than 0; an invalid value is rejected (returns false) rather than queued.
Returns false if the queue is full.
Sourcepub fn set_time_signature(&mut self, numerator: i32, denominator: i32) -> bool
pub fn set_time_signature(&mut self, numerator: i32, denominator: i32) -> bool
Queue a transport time-signature change for the next block. denominator must be one
of 1, 2, 4, 8, 16 and numerator must be positive; an invalid value is rejected
(returns false). Returns false if the queue is full.
Sourcepub fn set_playing(&mut self, playing: bool) -> bool
pub fn set_playing(&mut self, playing: bool) -> bool
Queue a transport playing-state toggle for the next block. Returns false if the queue
is full.
Sourcepub fn dropped_command_count(&self) -> u64
pub fn dropped_command_count(&self) -> u64
Total number of commands dropped because the queue was full since this control was created. A persistently rising count means the queue capacity is too small for the control rate.