bbx_plugin/lib.rs
1//! # BBX Plugin
2//!
3//! Plugin integration crate for the bbx_audio DSP library with C FFI bindings.
4//!
5//! This crate re-exports the `bbx_dsp` crate and provides a macro-based API for
6//! generating C-compatible FFI functions from any `PluginDsp` implementation.
7//! Consumers only need to add `bbx_plugin` as a dependency to access both DSP
8//! functionality and FFI generation.
9//!
10//! # Example
11//!
12//! ```ignore
13//! use bbx_plugin::{PluginDsp, DspContext, bbx_plugin_ffi};
14//!
15//! pub struct PluginGraph { /* DSP blocks */ }
16//!
17//! impl PluginDsp for PluginGraph {
18//! fn new() -> Self { /* ... */ }
19//! fn prepare(&mut self, context: &DspContext) { /* ... */ }
20//! fn reset(&mut self) { /* ... */ }
21//! fn apply_parameters(&mut self, params: &[f32]) { /* ... */ }
22//! fn process(&mut self, inputs: &[&[f32]], outputs: &mut [&mut [f32]], midi_events: &[MidiEvent], context: &DspContext) { /* ... */ }
23//! }
24//!
25//! impl Default for PluginGraph {
26//! fn default() -> Self { Self::new() }
27//! }
28//!
29//! // Generate all FFI exports
30//! bbx_plugin_ffi!(PluginGraph);
31//! ```
32
33mod audio;
34mod handle;
35mod macros;
36pub mod params;
37
38// Re-export the entire `bbx_*` crates as `*` so plugin projects only need bbx_plugin
39pub mod core {
40 pub use bbx_core::*;
41}
42pub mod dsp {
43 pub use bbx_dsp::*;
44}
45pub mod midi {
46 pub use bbx_midi::*;
47}
48
49// Re-export types needed by the macro
50pub use core::BbxError;
51
52pub use audio::process_audio;
53pub use dsp::{PluginDsp, context::DspContext};
54pub use handle::{BbxGraph, GraphInner, graph_from_handle, handle_from_graph};
55// Re-export parameter utilities
56pub use params::{
57 JsonParamDef, ParamDef, ParamType, ParamsFile, generate_c_header_from_defs, generate_rust_indices_from_defs,
58};