bbx_plugin
Plugin integration crate for bbx_audio DSP with C FFI bindings for JUCE and other C/C++ frameworks.
This crate re-exports bbx_dsp, so plugin projects only need to add bbx_plugin as a dependency.
Features
- Single dependency: Re-exports
bbx_dspfor convenient access to all DSP types - Macro-based code generation: Single macro generates all FFI exports
- RAII handle management: Safe opaque pointer lifecycle
- Buffer processing: Zero-copy audio buffer interop
- Plugin integration: Works with JUCE AudioProcessor
Cargo Features
ftz-daz
Enables hardware-level denormal prevention. When enabled, enable_ftz_daz() is called automatically during prepare(), setting CPU flags to flush denormal floating-point numbers to zero.
[]
= { = "...", = ["ftz-daz"] }
| Platform | Behavior |
|---|---|
| x86/x86_64 | Full FTZ + DAZ (inputs and outputs) |
| AArch64 (Apple Silicon) | FTZ only (outputs) |
| Other | No-op |
This is recommended for production audio plugins to avoid the 10-100x CPU slowdowns that denormals can cause.
simd
Enables SIMD optimizations for DSP processing. Requires nightly Rust.
[]
= { = "...", = ["simd"] }
Propagates to both bbx_core and bbx_dsp, enabling vectorized operations in supported blocks (Oscillator, LFO, Gain).
Usage
Implementing PluginDsp
use ;
// Generate FFI exports
bbx_plugin_ffi!;
Generated FFI Functions
The bbx_plugin_ffi! macro generates:
bbx_graph_create() -> *mut BbxGraph- Create plugin instancebbx_graph_destroy(handle)- Destroy plugin instancebbx_graph_prepare(handle, sample_rate, buffer_size, channels)- Prepare for playbackbbx_graph_reset(handle)- Reset statebbx_graph_process(handle, inputs, outputs, channels, samples, params, num_params, midi_events, num_midi_events)- Process audio with parameters and MIDI
JUCE Integration
See the workspace README for complete JUCE integration examples with CMake build setup.
License
MIT