Expand description
Transport and process context for audio plugins.
This module provides Transport for DAW timing/playback state and
ProcessContext which bundles transport with sample rate and buffer size.
§Example: Tempo-Synced Effect
ⓘ
fn process(&mut self, buffer: &mut Buffer, _aux: &mut AuxiliaryBuffers, context: &ProcessContext) {
// Calculate LFO rate synced to tempo
let lfo_hz = if let Some(tempo) = context.transport.tempo {
tempo / 60.0 / 4.0 // 1 cycle per 4 beats
} else {
2.0 // Fallback to 2 Hz
};
let samples_per_cycle = context.sample_rate / lfo_hz;
// ...
}§Example: Accessing MIDI CC Values
ⓘ
fn process(&mut self, buffer: &mut Buffer, _aux: &mut AuxiliaryBuffers, context: &ProcessContext) {
if let Some(cc) = context.midi_cc() {
let pitch_bend = cc.pitch_bend(); // -1.0 to 1.0
let mod_wheel = cc.mod_wheel(); // 0.0 to 1.0
let volume = cc.cc(7); // 0.0 to 1.0
}
}Structs§
- Process
Context - Complete processing context for a single
process()call. - Transport
- Host transport and timing information.
Enums§
- Frame
Rate - SMPTE frame rate for video synchronization.