Skip to main content

ProcessContext

Struct ProcessContext 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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: MidiBuffer

Host → plugin MIDI / note events for this block (sorted by sample offset).

§midi_out: MidiBuffer

Plugin → host MIDI / note events for this block (sorted by sample offset).

§notes: NoteBuffer

CLAP-shaped notes / expressions / poly mods (empty on VST3/LV2 today).

§notes_out: NoteBuffer

Plugin → host CLAP notes (NOTE_ON/OFF/CHOKE/END / expressions).

§ump: UmpBuffer

Host → plugin Universal MIDI Packets (MIDI 2 native + MIDI 1 as type 0x2).

§ump_out: UmpBuffer

Plugin → host UMP. CLAP emits CLAP_EVENT_MIDI2; VST3/LV2 down-convert.

§tuning: Tuning

Host-driven tuning context (CLAP clap.tuning).

Implementations§

Source§

impl ProcessContext

Source

pub fn new(sample_rate: f64, block_size: usize) -> ProcessContext

Source

pub fn with_process_mode(self, mode: ProcessMode) -> ProcessContext

Source

pub fn with_transport(self, transport: Transport) -> ProcessContext

Source

pub fn with_midi(self, midi: MidiBuffer) -> ProcessContext

Source

pub fn with_midi_out(self, midi_out: MidiBuffer) -> ProcessContext

Source

pub fn with_notes(self, notes: NoteBuffer) -> ProcessContext

Source

pub fn with_notes_out(self, notes_out: NoteBuffer) -> ProcessContext

Source

pub fn with_ump(self, ump: UmpBuffer) -> ProcessContext

Source

pub fn with_ump_out(self, ump_out: UmpBuffer) -> ProcessContext

Source

pub fn with_tuning(self, tuning: Tuning) -> ProcessContext

Source

pub fn clear_events(&mut self)

Clear all event buffers so the context can be reused across blocks.

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more