Skip to main content

Crate truce_loader

Crate truce_loader 

Source
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 PluginLogic type.

Structs§

AbiCanary
ABI fingerprint. Compared between shell and dylib before loading.
AudioBuffer
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.
EventList
Ordered list of events within a process block.
ProbePlugin
A plugin with known return values for vtable verification.
ProcessContext
Theme
Visual theme for the built-in GUI.
Transport
WidgetRegion
A widget’s hit region on screen.

Enums§

EventBody
ProcessResult
ProcessStatus
WidgetKind
Widget type for interaction state tracking.

Traits§

PluginLogic
The trait for hot-reloadable plugin logic.
RenderBackend
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.