#[non_exhaustive]pub struct ProcessContext {
pub sample_rate: f64,
pub block_size: usize,
pub process_mode: ProcessMode,
pub transport: Option<Transport>,
pub midi: MidiBuffer,
pub midi_out: MidiBuffer,
pub notes: NoteBuffer,
pub notes_out: NoteBuffer,
pub ump: UmpBuffer,
pub ump_out: UmpBuffer,
pub tuning: Tuning,
}Expand description
Per-block context handed to process().
Format wrappers fill Self::midi (7-bit) and Self::ump (native
packets). CLAP writes CLAP_EVENT_MIDI2 into ump unchanged and still
mirrors a MIDI 1 image into midi when one exists. VST3/LV2 lift 7-bit
MIDI into type-0x2 UMP so a plugin can read one buffer.
CLAP also fills Self::notes with native note-on/off/choke, note
expressions, and per-note PARAM_MOD (note_id >= 0).
Plugin → host: Self::midi_out (7-bit), Self::ump_out (native UMP;
CLAP emits CLAP_EVENT_MIDI2), Self::notes_out (NOTE_* / NOTE_END).
VST3/LV2 down-convert ump_out and On/Off/Choke.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.sample_rate: f64§block_size: usize§process_mode: ProcessMode§transport: Option<Transport>Host timeline for this block; None when the host provides none.
midi: MidiBufferHost → plugin MIDI / note events for this block (sorted by sample offset).
midi_out: MidiBufferPlugin → host MIDI / note events for this block (sorted by sample offset).
notes: NoteBufferCLAP-shaped notes / expressions / poly mods (empty on VST3/LV2 today).
notes_out: NoteBufferPlugin → host CLAP notes (NOTE_ON/OFF/CHOKE/END / expressions).
ump: UmpBufferHost → plugin Universal MIDI Packets (MIDI 2 native + MIDI 1 as type 0x2).
ump_out: UmpBufferPlugin → host UMP. CLAP emits CLAP_EVENT_MIDI2; VST3/LV2 down-convert.
tuning: TuningHost-driven tuning context (CLAP clap.tuning).
Implementations§
Source§impl ProcessContext
impl ProcessContext
pub fn new(sample_rate: f64, block_size: usize) -> ProcessContext
pub fn with_process_mode(self, mode: ProcessMode) -> ProcessContext
pub fn with_transport(self, transport: Transport) -> ProcessContext
pub fn with_midi(self, midi: MidiBuffer) -> ProcessContext
pub fn with_midi_out(self, midi_out: MidiBuffer) -> ProcessContext
pub fn with_notes(self, notes: NoteBuffer) -> ProcessContext
pub fn with_notes_out(self, notes_out: NoteBuffer) -> ProcessContext
pub fn with_ump(self, ump: UmpBuffer) -> ProcessContext
pub fn with_ump_out(self, ump_out: UmpBuffer) -> ProcessContext
pub fn with_tuning(self, tuning: Tuning) -> ProcessContext
Sourcepub fn clear_events(&mut self)
pub fn clear_events(&mut self)
Clear all event buffers so the context can be reused across blocks.