Skip to main content

Crate truce_standalone

Crate truce_standalone 

Source
Expand description

Standalone host for truce plugins.

Runs a plugin cdylib with direct cpal audio I/O and an optional GUI window (via baseview + the plugin’s own Editor). Zero plugin-library code is required - the runner obtains the editor via PluginExport::editor(), the same API every format wrapper uses.

§Entry point

Plugins supply a [[bin]] <suffix>-standalone target with a src/main.rs that calls:

fn main() {
    truce_standalone::run::<my_plugin::Plugin>();
}

§Modes

  • Windowed (default, requires gui feature): opens a baseview window hosting the plugin’s editor, drives a cpal stream on the audio thread.
  • Headless (--headless flag or the gui feature disabled): audio only. For effects this means audio passes through; for instruments the plugin emits silence unless a MIDI device is connected (--midi-input; see midi).

See cli for the full flag surface.

Modules§

audio
Shared cpal audio setup + callback. One implementation used by both windowed and headless runners.
cli
CLI parser with strict precedence.
headless
Headless standalone: audio + MIDI device input, no window.
keyboard
QWERTY keyboard to MIDI note mapping.
midi
MIDI device input via midir.
presets
Preset library access for the standalone host.
state
--state <path> load helper, shared by windowed, headless, and offline runners. Wraps truce_core::state::restore_plugin with a uniform diagnostic surface so users see the same failure messages no matter which mode they launched in.
transport
Minimal transport model for standalone mode.

Structs§

Defaults
Plugin-author launch defaults - used as the lowest tier of the CLI parser, beneath argv and TRUCE_STANDALONE_* env vars. Empty Defaults::default() lets every value fall through to the compiled runtime default (input off, output on, cpal-picked devices). Pass to run_with when you want to override.

Traits§

PluginExport
Unified export trait for all plugin formats.

Functions§

is_verbose
True when --verbose / -v (or TRUCE_STANDALONE_VERBOSE=1) was passed at launch. Errors and --list-* output ignore this flag.
run
Run the plugin standalone with no plugin-author defaults. Argv, env, and the compiled runtime defaults are the only inputs. Dispatches to the windowed or headless runner; returns when the user closes the window or sends SIGINT.
run_with
Run the plugin standalone with the supplied launch defaults. Argv and env still take precedence - defaults only fills in values neither layer set. Same dispatch as run.