Skip to main content

RtControl

Struct RtControl 

Source
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

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.