Skip to main content

plughost_formats/
lib.rs

1//! In-process VST3, Audio Unit, and CLAP hosting for plughost.
2//!
3//! Plugins are loaded into the calling process. Load plugins, change their lifecycle, and use their
4//! controllers on one thread, normally the main thread; plugins that show dialogs or editors need
5//! that thread to run the OS event loop. Applications that need crash isolation use the plughost
6//! crate, which runs these hosts in helper processes.
7//!
8//! [`load`] creates a plugin of any enabled format from a `PluginRef`; each format's `Plugin` can
9//! also be created directly, from a loaded `vst3::Module` or `clap::Entry`, or from an Audio Unit
10//! class ID. Loading is the step that runs the plugin's own code, which nothing can check:
11//! [`load`], `vst3::Module::load`, `clap::Entry::load` and `au::Plugin::new` are `unsafe fn`, and
12//! reading a loaded plugin afterwards is safe. Every plugin is used through [`HostedPlugin`] and
13//! processed from another thread through the [`BlockProcessor`] it hands out. Every format fails with one
14//! [`Error`], which tells the [`FailureKind`](plughost_core::FailureKind), the format, the native
15//! result code and the cause. An owner that processes plugins on a thread of its own gives them an
16//! [`AudioThread`], so the audio-thread calls they need between blocks run there too. Plugins
17//! process, reset and flush with subnormal numbers flushed to zero (MXCSR FTZ and DAZ on x86-64,
18//! FPCR.FZ on AArch64); the calling thread's mode is restored after each call.
19//!
20//! The [detailed API guide](https://github.com/emulette/plughost/blob/v0.2.6/llms.txt)
21//! describes format capabilities and the application-level processing contracts.
22
23#![warn(missing_docs)]
24
25#[cfg(all(feature = "au", target_os = "macos"))]
26pub mod au;
27mod audio_thread;
28#[cfg(feature = "clap")]
29pub mod clap;
30mod errors;
31#[cfg(any(
32    feature = "clap",
33    feature = "vst3",
34    all(feature = "au", target_os = "macos")
35))]
36mod float_mode;
37mod hosted;
38mod parameter_choices;
39#[cfg(any(
40    feature = "clap",
41    feature = "vst3",
42    all(feature = "au", target_os = "macos")
43))]
44mod parameter_values;
45pub mod preset;
46#[cfg(feature = "clap")]
47mod state_stream;
48#[cfg(all(
49    test,
50    any(
51        feature = "clap",
52        feature = "vst3",
53        all(feature = "au", target_os = "macos")
54    )
55))]
56mod timing_tests;
57#[cfg(feature = "vst3")]
58pub mod vst3;
59
60pub use audio_thread::AudioThread;
61pub use errors::Error;
62pub use hosted::{BlockProcessor, EditorRequest, EditorView, HostedPlugin, ResizeRequest, load};
63
64#[cfg(test)]
65mod preset_corpus;