Generic native adapter (0.1.0 prototype)¶
adapters/auv2 builds any local product exporting ravet_plugin_v1() as an
AUv2 component, using Apple's external AudioUnitSDK directly. Effects derive
from AUEffectBase, instruments from MusicDeviceBase, and audio-backed MIDI
effects from AUMIDIEffectBase. This implements the native AU choice in
decision 0281; there is no VST3 module
inside this component.
CARGO_BUILD_JOBS=2 python3 scripts/bundle-au.py --plugin delay \
--audio-unit-sdk /path/to/AudioUnitSDK --validate
This builds only the chosen product and the native adapter. The SDK path must
be an Apple source checkout with include/AudioUnitSDK and src/AudioUnitSDK
(1.4.0 was exercised), rather than JUCE's flattened SDK snapshot. Fetch it with
python3 scripts/fetch-audio-unit-sdk.py "$HOME/Library/Application Support/ravet/sdks/AudioUnitSDK"
which downloads Apple's AudioUnitSDK-1.4.0 tag from GitHub, checks a SHA-256
pin before opening it, and extracts only include/AudioUnitSDK,
src/AudioUnitSDK and the Apache-2.0 LICENSE.txt. Point [sdks] audio_unit
in a ravet-sdks.toml at the result (for the per-user file
above, audio_unit = "sdks/AudioUnitSDK") so builds need no flag. Nothing is
vendored in this repository. CMake, Xcode's command-line tools and
Python 3.11 or later are required. The default build architecture is the current
machine's architecture; recorded execution is macOS arm64 only. The
support matrix separates the component/validator receipts
from the manual Delay run in Logic Pro (version not recorded).
For a separate consumer, pass --manifest-path /path/to/product/Cargo.toml.
Its cdylib must use export_plugin! with ravet-plugin feature native
(umbrella plugin-native). Alternatively, --product-library /path/to/product.dylib
uses an already built trusted local library. The build runs a small metadata
tool that loads this library and calls ravet_plugin_v1; use trusted binaries.
--build-dir selects the output directory. The default delay output is
target/au-native/delay/AU/ravet_au.component.
The product table supplies the AudioComponents name, version and type/subtype/
manufacturer, parameter IDs, channel layouts and editor class identity. The
component contains its product dylib in Contents/Frameworks, with a unique
install name and a relative loader path. It includes RAVET/Apple licence
notices and receives an ad hoc signature. Production signing remains a consumer
responsibility. --native-editor is a legacy-reference option; the native
adapter automatically advertises an editor when the table declares one.
Parameters, audio and state¶
AU parameters use the product's permanent host IDs and physical values. Ranges, units, automation/read-only/hidden flags and logarithmic display hints come from the table. Integer-spaced stepped ranges expose indexed value strings; other stepped ranges retain their physical ranges and snap through the table. String conversion properties call the product's text functions.
Main-thread host changes call set_value, so a state save before rendering
includes them. Non-main parameter changes, scheduled immediate/ramped parameters
and MIDI input enter a fixed 1,024-event render queue. Scheduling/MIDI producers
must be serialized with rendering, as must stopped prepare/reset/retirement.
Schedule lists preflight completely before queue mutation. Ramps expand to
per-sample physical events within this bound, with a boundary endpoint carried
to offset zero of the next render. Events beyond the current render boundary
reject the block; multi-block ramps are not implemented. Same-offset order is
preserved. The table owns automation/bypass policy and denormal handling.
The current audio profile is one main bus, planar native f32, 1..65,536 frames,
0..64 input channels and 1..64 output channels. All advertised layouts must
agree on whether an input bus exists. Mono packed f32 is also accepted. The
product's auxiliary buses
follow as extra input/output elements, named after the bus, with fixed channel
counts and the main element's sample rate. An unconnected or failing auxiliary
input is silent (a failing main input still faults the block); output elements
are rendered together once per render cycle. Without a main input, an
auxiliary input becomes input element 0 and the advertised channel table
reports its channel count as the input count, because hosts and auval read
input element 0 as the main input. Effect-based units without a main input
(MIDI effects, aumf) skip the SDK effect base's initialization, which reads
input element 0. The adapter needs AudioUnitSDK 1.4 or later; CMake stops with
a message on older copies (detected by GetBufferListOrError). There is no f64
negotiation. The product may
impose tighter limits. Malformed blocks fail with silence on supported output
prefixes; backing tails remain outside the processing range.
ClassInfo and ClassInfoFromDocument dictionaries store the unchanged versioned
save_state envelope as CFData under RAVET, alongside standard component
identity and preset-name keys. Restore validates the dictionary and delegates
all-or-none decoding/import/migration to load_state. The bypass property maps
to bypass_index and is included in complete state recall. This differs from
the historical VST3 wrapper's separate bypass preservation below.
Latency and tail are cached from timing after preparation and between render
calls. Changes schedule main-run-loop property notifications, including
latency_changed and tail changes without latency changes. Infinite tails use
positive infinity. Host beat/tempo, signature and transport callbacks are
validated through RavetAuTransport.hpp at block start. A transport sample
position within Float64 residue of an integer (REAPER reports, for example,
3584.0000000000005) is canonicalized to that integer. A malformed tuple,
including a genuinely fractional position, still makes the block output silence
and return an error without calling the product
(decision 0294). Short MIDI input maps
to native MIDI events; declared note output uses the bounded
kAudioUnitProperty_MIDIOutputCallback path. Missing/rejecting output callbacks
do not undo audio or replay events; callback changes require an uninitialized
unit. SysEx, MIDI 2, MusicDevice StartNote/StopNote,
factory-program catalogues and MIDI-only zero-audio layouts are not implemented.
Cocoa lifetime and validation¶
The Cocoa factory calls editor_open with VIEW_COCOA, resizes within the
product's bounds, and closes the editor before destroying the product. A 30 Hz
main-run-loop timer calls editor_idle, drains take_edits, and reports
begin/value/end gestures through AUEventListenerNotify. The NSView and timer
hold weak lifetime tokens. A host may retain the view after disposing the AU;
subsequent view resizing and destruction cannot reach the retired instance.
Control calls marked MAIN by the table are dispatched to the AppKit thread.
Hosts must provide a running main loop for these calls and notifications.
--validate runs in-process actual-component contracts; the supplied product
smoke fixture expects a stereo layout and, except for Evidence Synth, an editor. Other products can build
without this fixture. For the delay it also
checks the 120 BPM eighth-note impulse at sample 2,000 at 8 kHz, state saved
before render, complete bypass recall, offset-16 automation and dynamic tail.
It also replays REAPER 7.82's 48 kHz/512-frame calling pattern, with transport
samples one ulp off whole block starts: fixed 100 ms echoes must land at
exactly +4,800 and synced eighth-note echoes at 150 BPM at exactly +9,600. The
generic host callback reports 456 plus one ulp for every product.
The mock exercises effects, instruments and audio-backed MIDI effects:
python3 scripts/bundle-au.py --mock effect \
--audio-unit-sdk /path/to/AudioUnitSDK --validate
python3 scripts/validate-au-mock.py \
target/au-native/mock-effect/AU/ravet_au.component \
--log target/au-native/mock-effect/auval.log
# Repeat with --mock instrument or --mock midi and the corresponding directory.
The validator script accepts only the test identities aufx/RvT1/RvTs,
aumu/RvI1/RvTs and aumf/RvM1/RvTs, refuses to overwrite an existing component,
and removes its temporary user Components installation in finally. It retries
only asynchronous discovery failures. On macOS 27.0.1 arm64/Xcode 27.1, all
three returned exit 0, AU VALIDATION SUCCEEDED. Actual-component contracts
also passed three retained-view disposal cycles per variant and the real delay.
See work status for exact commands and evidence. These results
do not establish a DAW, device, callback deadline, sandbox, commercial-signing
or x86_64 support claim.