pub struct Script { /* private fields */ }Expand description
Sample-accurate sequence of events fed to the plugin during a
run. Cursor advances via wait_ms / wait_samples; events
land at the current cursor position.
Implementations§
Source§impl Script
impl Script
pub fn note_on(&mut self, note: u8, velocity: f32)
pub fn note_off(&mut self, note: u8)
pub fn cc(&mut self, cc: u8, value: f32)
pub fn pitch_bend(&mut self, normalized: f32)
pub fn channel_pressure(&mut self, value: f32)
Sourcepub fn set_param(&mut self, id: impl Into<u32>, normalized: f64)
pub fn set_param(&mut self, id: impl Into<u32>, normalized: f64)
Set a parameter to a normalized [0.0, 1.0] value, sample-
accurate at the cursor’s offset. The plugin sees a
ParamChange event in its event list - same delivery path
CLAP / VST3 / AU automation lanes use.
Sourcepub fn raw(&mut self, body: EventBody)
pub fn raw(&mut self, body: EventBody)
Push an arbitrary EventBody at the current cursor - escape
hatch for events Script doesn’t have a typed helper for.
Sourcepub fn wait_ms(&mut self, ms: u64)
pub fn wait_ms(&mut self, ms: u64)
Advance the cursor by ms milliseconds at the run’s sample
rate. Resolves correctly only after Script::sample_rate is
filled in by PluginDriver::run - call sites can rely on the
driver wiring it before scanning the script.
wait_ms(0) is almost always a copy-paste artifact and
trips a debug_assert in dev builds. If you genuinely want
“schedule the next event at the current cursor”, that’s the
implicit default - drop the call. If you want a typed no-op
for clarity (e.g. mirroring a user-supplied delay variable
that can be zero), use wait_samples(0) which doesn’t
trip the assertion.
Sourcepub fn wait_samples(&mut self, n: usize)
pub fn wait_samples(&mut self, n: usize)
Advance the cursor by n samples.