pub trait Plugin: Send + 'static {
// Required methods
fn info() -> PluginInfo
where Self: Sized;
fn reset(&mut self, sample_rate: f64, max_block_size: usize);
fn process(
&mut self,
buffer: &mut AudioBuffer<'_>,
events: &EventList,
context: &mut ProcessContext<'_>,
) -> ProcessStatus;
// Provided methods
fn bus_layouts() -> Vec<BusLayout>
where Self: Sized { ... }
fn init(&mut self) { ... }
fn save_state(&self) -> Option<Vec<u8>> { ... }
fn load_state(&mut self, _data: &[u8]) { ... }
fn editor(&mut self) -> Option<Box<dyn Editor>> { ... }
fn latency(&self) -> u32 { ... }
fn tail(&self) -> u32 { ... }
fn get_meter(&self, _meter_id: u32) -> f32 { ... }
}Expand description
The core trait that all plugins implement.
Required Methods§
Sourcefn info() -> PluginInfowhere
Self: Sized,
fn info() -> PluginInfowhere
Self: Sized,
Static metadata about the plugin.
Use plugin_info!() for zero-boilerplate (reads from truce.toml
- Cargo.toml). Requires
truce-buildin[build-dependencies].
Sourcefn reset(&mut self, sample_rate: f64, max_block_size: usize)
fn reset(&mut self, sample_rate: f64, max_block_size: usize)
Called when sample rate or max block size changes. Reset filters, delay lines, etc. Not real-time safe.
Sourcefn process(
&mut self,
buffer: &mut AudioBuffer<'_>,
events: &EventList,
context: &mut ProcessContext<'_>,
) -> ProcessStatus
fn process( &mut self, buffer: &mut AudioBuffer<'_>, events: &EventList, context: &mut ProcessContext<'_>, ) -> ProcessStatus
Real-time audio processing.
Provided Methods§
Sourcefn bus_layouts() -> Vec<BusLayout>where
Self: Sized,
fn bus_layouts() -> Vec<BusLayout>where
Self: Sized,
Supported bus layouts. The host picks one.
Sourcefn save_state(&self) -> Option<Vec<u8>>
fn save_state(&self) -> Option<Vec<u8>>
Save extra state beyond parameter values.
Sourcefn load_state(&mut self, _data: &[u8])
fn load_state(&mut self, _data: &[u8])
Restore extra state.
Sourcefn latency(&self) -> u32
fn latency(&self) -> u32
Processing latency in samples. Host uses this for delay compensation. Return 0 if the plugin adds no latency (default).