Expand description
Hot-reloadable plugin logic for truce.
Split your plugin into a static shell (loaded by the DAW) and a
hot-reloadable logic dylib (reloads on recompile). The developer
implements PluginLogic — a safe Rust trait — and exports it
via #[no_mangle] functions. The shell loads the dylib, verifies
ABI compatibility, and delegates audio processing + GUI rendering
to the trait object.
§For the logic dylib
ⓘ
use truce_loader::prelude::*;
struct MyPlugin { /* ... */ }
impl PluginLogic for MyPlugin { /* ... */ }
#[no_mangle]
pub fn truce_create() -> Box<dyn PluginLogic> { Box::new(MyPlugin::new()) }
#[no_mangle]
pub fn truce_abi_canary() -> AbiCanary { AbiCanary::current() }
#[no_mangle]
pub fn truce_vtable_probe() -> Box<dyn PluginLogic> { Box::new(ProbePlugin) }Modules§
- prelude
- Convenience prelude for logic dylib authors.
- static_
shell - StaticShell — embeds PluginLogic directly into the plugin binary.
Macros§
- export_
plugin - Export the three
#[no_mangle]functions required by the shell. - export_
static - Compile-time static embedding of a
PluginLogictype.
Structs§
- AbiCanary
- ABI fingerprint. Compared between shell and dylib before loading.
- Audio
Buffer - Non-interleaved audio buffer. Zero-copy — borrows host memory through the format wrapper.
- Color
- Color as RGBA (0.0–1.0).
- Event
- A timestamped event within a process block.
- Event
List - Ordered list of events within a process block.
- Probe
Plugin - A plugin with known return values for vtable verification.
- Process
Context - Theme
- Visual theme for the built-in GUI.
- Transport
- Widget
Region - A widget’s hit region on screen.
Enums§
- Event
Body - Process
Result - Process
Status - Widget
Kind - Widget type for interaction state tracking.
Traits§
- Plugin
Logic - The trait for hot-reloadable plugin logic.
- Render
Backend - Abstraction over rendering backends (CPU via tiny-skia, future GPU via wgpu).
Functions§
- default_
hit_ test - Default hit test: circular for knobs, rectangular for others, skip meters.
- verify_
probe - Verify a probe plugin returns the expected values.