ara2-bridge
Safe Rust bindings for the Celemony ARA2 SDK.
ARA2 (Audio Random Access) lets audio plugins access DAW audio regions directly — not just streaming audio at the insert point. This crate wraps the C API as Rust traits with vtable builders, so you can write ARA2 plugins in pure Rust.
Crates
| Crate | Purpose |
|---|---|
ara2-bridge-sys |
Raw FFI bindings generated by bindgen from ARAInterface.h. 2,557 lines, 210 types, 55-field vtable structs. |
ara2-bridge |
Safe Rust wrapper. DocumentController trait + vtable builder. Implements 25 of 55 vtable entries; null entries signal "not supported" per the ARA2 spec. |
Installation
[]
= "0.1.4"
This pulls in ara2-bridge-sys automatically. You do not need to depend on it directly unless you want raw FFI access.
Usage
1. Implement the DocumentController trait
use *;
use *;
;
2. Build the vtable and instance
use build_document_controller_instance;
// Create your controller
let controller = Boxnew;
// Build the C-compatible instance
let instance = build_document_controller_instance;
// `instance` is a `*const ARADocumentControllerInstance` —
// pass it to the DAW through the ARAFactory callback.
3. Wire into the ARAFactory
The ARAFactory struct is defined in ara2-bridge-sys. Fill in the static fields:
use *;
use CStr;
static FACTORY: ARAFactory = ARAFactory ;
unsafe extern "C"
unsafe extern "C"
unsafe extern "C"
Architecture
ARA2 uses C structs of function pointers (vtables). The DAW calls into these structs to communicate with the plugin. Each vtable has a structSize field that tells the host which functions are present; null entries are treated as "not supported."
DAW calls ARAFactory::createDocumentControllerWithDocument()
│
▼
Your callback returns an ARADocumentControllerInstance
│
├── documentControllerRef → opaque pointer to your Rust state
└── documentControllerInterface → pointer to vtable struct
DAW calls vtable functions:
beginEditing() → trait method
createAudioSource() → trait method
requestAudioSourceContentAnalysis() → your analysis engine
storeObjectsToArchive() → serialization
destroyDocumentController() → cleanup
Implemented Vtable Entries (25 of 55)
destroyDocumentController,getFactorybeginEditing,endEditing,notifyModelUpdatesupdateDocumentPropertiescreateAudioSource,updateAudioSourceProperties,updateAudioSourceContentenableAudioSourceSamplesAccess,deactivateAudioSourceForUndoHistorydestroyAudioSourcerequestAudioSourceContentAnalysis,isAudioSourceContentAvailablecreateMusicalContext,updateMusicalContextProperties,updateMusicalContextContent,destroyMusicalContextcreateRegionSequence,updateRegionSequenceProperties,destroyRegionSequencecreatePlaybackRegion,updatePlaybackRegionProperties,destroyPlaybackRegionstoreObjectsToArchive,restoreObjectsFromArchive
Not Yet Implemented (30 of 55)
Audio modifications, content readers, content grades, processing algorithms, licensing, and audio file chunks. These return null pointers; the DAW treats them as unsupported features. They will be added in future versions based on community demand.
Companion API Integration
ARA2 plugins are distributed as VST3 extensions. The ARAVST3.h, ARACLAP.h, and ARAAudioUnit.h headers in ara2-bridge-sys provide the companion API types. You'll need:
- VST3: Register the ARA2 factory in your VST3 plugin's
IPlugView/IComponentimplementation - CLAP: Register via
clap_plugin_araextension - AU: Register via
AudioUnitproperties
These integrations are handled by your plugin framework (nih-plug, vst3-rs, or manual FFI), not by this crate.
Building
Requires clang (for bindgen). The ara2-bridge-sys crate generates bindings from ARAInterface.h at build time.
License
MIT OR Apache-2.0
The ARA2 SDK headers (ARAInterface.h, ARAVST3.h, etc.) are Copyright Celemony Software GmbH and distributed under the Celemony ARA2 License. Plugin developers must agree to Celemony's ARA2 terms separately.