| Crates.io | bbx_plugin |
| lib.rs | bbx_plugin |
| version | 0.4.3 |
| created_at | 2025-12-30 00:39:02.099836+00 |
| updated_at | 2026-01-15 17:30:09.503359+00 |
| description | Plugin integration crate for bbx_audio DSP library with C FFI bindings |
| homepage | |
| repository | https://github.com/blackboxaudio/bbx_audio |
| max_upload_size | |
| id | 2011774 |
| size | 43,003 |
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.
bbx_dsp for convenient access to all DSP typesftz-dazEnables 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.
[dependencies]
bbx_plugin = { version = "...", features = ["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.
simdEnables SIMD optimizations for DSP processing. Requires nightly Rust.
[dependencies]
bbx_plugin = { version = "...", features = ["simd"] }
Propagates to both bbx_core and bbx_dsp, enabling vectorized operations in supported blocks (Oscillator, LFO, Gain).
use bbx_plugin::{PluginDsp, DspContext, bbx_plugin_ffi};
pub struct MyPlugin {
// Your DSP state
}
impl PluginDsp for MyPlugin {
fn new() -> Self {
MyPlugin { /* ... */ }
}
fn prepare(&mut self, context: &DspContext) {
// Called before processing starts
}
fn reset(&mut self) {
// Called when playback stops
}
fn apply_parameters(&mut self, params: &[f32]) {
// Called when parameters change
}
fn process(
&mut self,
inputs: &[&[f32]],
outputs: &mut [&mut [f32]],
midi_events: &[MidiEvent],
context: &DspContext,
) {
// Audio processing (midi_events for synthesizers)
}
}
impl Default for MyPlugin {
fn default() -> Self {
Self::new()
}
}
// Generate FFI exports
bbx_plugin_ffi!(MyPlugin);
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 MIDISee the workspace README for complete JUCE integration examples with CMake build setup.
MIT