AU v3 Skill
Use this skill when touching Pulp's Audio Unit v3 adapter, when
answering questions about how a Pulp plugin behaves inside Logic Pro,
GarageBand, MainStage, AUM, Cubasis, or any AUv3-aware iOS host, or
when an auval run fails. AU v3 is one of Pulp's three first-class
first-party formats; unlike AU v2 (which is owned by the view-bridge
skill via au_v2_adapter.cpp), AU v3 is the modern AUAudioUnit
subclass surface.
When to use
- Editing
core/format/src/au_adapter.mm— thePulpAudioUnit
AUAudioUnit subclass.
- Editing
core/format/src/au_entry.mm— the
AUAudioUnitFactory-conforming entry object (PulpAUFactoryObj)
and the PulpAUFactory component entry symbol.
- Touching
core/format/src/au_audio_unit.h— the Obj-C forward
declaration used by au_entry.mm and the iOS view controller.
- Editing the iOS extension view controller
(core/format/src/au_view_controller_ios.mm) — but first read the
ios and view-bridge skills; that file is also mapped to
them.
- An AUv3 host reports a behaviour issue — sidechain pull missing,
sysex dropped, parameter tree blank, preset recall fails, MIDI-out
not delivered.
- An
auvalpass regresses. - Working on ARA-aware AU — but start with the
araskill; the AU
story there is the audioUnitARAFactory KVO property.
AU v2 (core/format/src/au_v2_adapter.cpp) is a separate adapter
covered by its own auv2 skill. AU v2 is AUEffectBase-based and
used where hosts require the classic v2 Component Manager API. **Do
not edit au_v2_adapter.cpp as part of AU v3 work.**
Files and entry points
| Role | Path |
|---|---|
| Core adapter (Obj-C++) | core/format/src/au_adapter.mm |
| Forward declaration used by entry / view | core/format/src/au_audio_unit.h |
| Component entry factory | core/format/src/au_entry.mm |
| iOS AUv3 extension view controller | core/format/src/au_view_controller_ios.mm (also mapped to ios + view-bridge skills) |
| Contract-editor view (both controllers) | core/format/src/au_v3_contract_view.{h,mm} |
| iOS AU audio session helper | core/format/src/ios_audio_session.cpp, core/format/include/pulp/format/ios_audio_session.{h,hpp} |
| Info.plist template (AU component bundle) | tools/cmake/PulpInfoPlist.au.in |
| AudioUnitSDK fetch (used primarily by AU v2 but shared utilities reach AU v3) | external/AudioUnitSDK (Apache 2.0) |
| Tests | test/test_ios_audio_session.cpp, test/test_ios_background_audio_flag.cpp (iOS-specific); test/test_au_v3_contract_view.mm (the contract view), test/test_au_v3_view_controller.mm (the macOS controller over a real PulpAudioUnit); AU v3 shares state / processor tests with CLAP / VST3 |
| CLI validator invocation | tools/cli/cmd_validate.cpp — runs auval via the auval-<name> CTest target |
There is no PulpAU3.cmake; AU v3 targets are wired directly in the
top-level CMake plugin helpers alongside AU v2 and the iOS extension
target.
Core conventions
`AUAudioUnit`, not `AUEffectBase`
AU v3 uses AUAudioUnit as the plugin base class — Apple's modern,
block-based render API. AU v2 (AUEffectBase) and AU v3
(AUAudioUnit) are **two different C++ classes and two separate
.component bundles**. Pulp ships both where applicable; the
v3 subclass is PulpAudioUnit in au_adapter.mm.
The bridge struct pulp::format::au::AUBridge owns:
std::unique_ptr<Processor> processor+state::StateStore store
— the same Pulp DSP + state objects used by the CLAP/VST3 adapters.
- Pre-allocated
output_ptrs,input_ptrs,sidechain_ptrs(sized
to kMaxChannels = 8) so the render block never allocates.
InputBufferStorage input_abland `SidechainBufferStorage
sidechain_abl — pre-sized AudioBufferList` structs for the
AURenderPullInputBlock pulls. The sidechain has its own ABL
so it doesn't alias the main input pull.
sidechain_storage— astd::vector<float>backing buffer for the
sidechain pull so the adapter can stay allocation-free on the audio
thread after allocateRenderResources.
param_events(state::ParameterEventQueue) — cleared each render
block and filled from inbound AU parameter/ramp render events with
their sample offsets while the StateStore dual-write keeps normal
block-level parameter reads current.
Entry point: `PulpAUFactory` + `AUAudioUnitFactory`
macOS: the .appex stub uses Apple's _NSExtensionMain
entry point. NSExtensionPrincipalClass in Info.plist points at
PulpAUMacViewController, which adopts AUAudioUnitFactory directly
— its createAudioUnitWithComponentDescription:error: allocs a
PulpAudioUnit. The legacy PulpAUFactory C component-registration
function is NOT used on macOS; everything goes through PlugInKit's
extension lifecycle. See the "macOS AU v3 packaging" section below
for the full framework + stub .appex + container .app architecture.
iOS (legacy monolithic .appex): au_entry.mm still defines
PulpAUFactoryObj (NSObject conforming to <AUAudioUnitFactory>) and
the C entry symbol PulpAUFactory(const AudioComponentDescription*).
iOS uses the same _NSExtensionMain path via Apple's
AUViewController-based principal class
(PulpAUViewController in au_view_controller_ios.mm); the C entry
remains as a no-op safety net for AudioComponentInstantiate-style
direct loads. The PULP_AUV3_PLUGIN() macro (in
<pulp/format/au_v3_entry.hpp>) is what registers the per-plugin
processor factory at static init — no force_link shim required.
Bus construction
When PluginDescriptor::supported_bus_layouts is non-empty, expose those main
input/output pairs through channelCapabilities. Keep that advertised list and
Processor::is_bus_layout_supported() aligned during negotiation.
Inside initWithComponentDescription:…:
- Output bus: one
AUAudioUnitBusat 48 kHz default with
desc.default_output_channels() channels.
- Main input bus: when
desc.default_input_channels() > 0, one
AUAudioUnitBus with that channel count.
- Sidechain bus: when
desc.input_buses.size() > 1and
desc.input_buses[1].default_channels > 0, a further input
AUAudioUnitBus. Its index is whatever position it lands at in
inBusses — 1 behind a main input bus, 0 when the main input declares no
channels — and _bridge.sidechain_bus_index records it when the bus is
created so the render block pulls the index the host sees. A pull hard-coded
to 1 asked for a bus that did not exist on the side-chain-only shape.
This mirrors the CLAP / VST3 "bus 0 = main, bus 1 = sidechain" rule for the
common shape. Instruments get the same buses as effects: an instrument that
declares input buses (optional, so it validates unconnected) exposes them and
is pulled the same way; nothing in the category hides them.
Parameters: `AUParameterTree`
Parameter metadata is semantic, not range-inferred: ParamInfo::kind selects
continuous/integer/boolean/indexed behavior, and value_labels supplies the
reversible label table. String conversion must use the shared canonical helpers
so host text entry, labels, units, finite checks, snapping, and author-exception
containment stay identical to CLAP/VST3/AUv2/AAX.
- (AUParameterTree *)parameterTree builds one AUParameter per
StateStore param:
AUParameterAddressis the PulpParamIDcast touint64_t.unitis mapped from Pulp's unit string
(dB → kAudioUnitParameterUnit_Decibels, Hz → _Hertz, % →
_Percent, boolean-shaped ranges → _Boolean, everything else →
_Generic).
implementorValueObserverwrites host param changes into
store.set_value_rt(id, value). **AUv3 hosts may invoke the observer
from arbitrary threads, including the render thread** — use
set_value_rt, not the generic set_value. The RT path writes the
atomic and pushes an SPSC event for ListenerThread::Main listeners;
the editor drains via store.pump_listeners(). The generic path
would heap-allocate the dispatch lambda on a possibly-audio thread.
implementorValueProviderreads current values back from the store.implementorStringFromValueCallbackdelegates to
ParamInfo::to_string when provided, otherwise a %.2f fallback.
flagsis no longer the hard-codedIsWritable | IsReadable. It is derived
per parameter from the shared predicates state::is_hidden_param /
is_read_only_param / is_automatable_param, using the **same AU flag
mapping as the v2 adapter** (au_v2_common.cpp documents why each flag was
chosen): read-only withholds IsWritable and adds MeterReadOnly, hidden
adds the ExpertMode display hint, non-automatable adds NonRealTime. AU has
no literal hidden/readonly/automatable triple, so ExpertMode in particular
is a hint a host may ignore — do not describe it as hiding the parameter.
ParamInfo::affects_others adds IsGlobalMeta the same way as v2.
Keep the two AU adapters' mappings identical: they are separate code (this
tree vs fill_parameter_info) reading one model, and the whole point of the
shared predicates is that a plugin's parameters describe themselves the same
way in v2 and v3. Test: test/test_au_param_visibility.mm asserts both.
Worth knowing for the next flag: this was a core/state gap, not an AU one —
VST3 and CLAP could not express these either, because ParamInfo had no
field, so the fix was one model change rather than three adapter patches.
__weak capture + strongSelf null-check pattern is deliberate —
Obj-C blocks on AUParameterTree must not retain the audio unit.
UI → host automation write-back
For Logic (and any AUv3 host) to record automation when the user
moves a slider in the plugin's own editor, edits have to flow back out
through the AUParameterTree — observing the tree only carries host →
plugin. The adapter closes the loop:
- Cache the tree.
parameterTreereturns the same instance on every
call (if (_parameterTree) return _parameterTree;). The host's
automation-observer token is registered against one tree object; a
fresh tree per call would orphan the token and silently drop
automation. _parameterTree is [tree retain]-ed — **au_adapter.mm is
MRC, not ARC** (-fno-objc-arc), so the autoreleased tree must be
explicitly retained or it dangles and the next edit SIGSEGVs.
- Audio-thread store listener. An inline
store.add_listener(cb, ListenerThread::Audio) fires on every param
change; the callback calls
`[param setValue:v originator:_automationToken
atHostTime:0 eventType:AUParameterAutomationEventTypeValue]` so the
host sees the new value at the right address.
- Gestures → Touch / Release. `store.set_gesture_callbacks(begin,
end) maps begin_gesture/end_gesture` to
AUParameterAutomationEventTypeTouch and …Release. Without the
Touch/Release pair, Logic records values but won't arm a write pass.
The gesture callback is a stateless C++ lambda taking
(PulpAudioUnit*, ParamID, eventType) — an Obj-C stack-block captured
in a C++ std::function that outlives the scope would be use-after-
free under MRC (no automatic Block_copy).
- Loop guard. A
thread_local bool g_au_v3_host_writingwraps the
implementorValueObserver write. The store listener checks it and
skips the write-back when the change originated from the host, so a
host automation move doesn't echo straight back into the host.
- dealloc must
set_gesture_callbacks({}, {}), reset the listener
token, removeParameterObserver: the automation token, and
[_parameterTree release] — in that order — before the existing
_mainThreadToken teardown.
Test: test/test_au_plugin_state.mm →
[au][auv3][params][automation] drives
begin_gesture/set_value/end_gesture through the real store and
asserts a host-side tokenByAddingParameterAutomationObserver block
observes Touch + Value + Release (async — pump the runloop until the
event count reaches 3).
Render block
- (AUInternalRenderBlock)internalRenderBlock returns a block that
captures a raw &_bridge pointer (Obj-C __block / ARC semantics do
not apply — _bridge is a C++ struct). The block:
- Zeroes outputs and returns
noErrif the Processor is null (host
calling render before allocateRenderResources succeeded).
- Rejects
frameCount > maximumFramesToRenderwith
kAudioUnitErr_TooManyFramesToProcess. If a host or validator
passes null or undersized outputData->mBuffers[i].mData, the
adapter assigns slices from AUBridge::output_storage, which is
pre-sized in allocateRenderResources. Do not heap-allocate in the
steady-state render path.
- Pulls the main input via
pullInputBlock(…, 0, &input_abl). This
reuses the output buffers as the input destination — in-place
processing is allowed (canProcessInPlace returns YES).
- Pulls the sidechain (if enabled) via
pullInputBlock(…, 1, &sidechain_abl) into the separate backing
storage; publishes to processor->set_sidechain(&view) only on
success, nulls out the slot on failure.
- Walks the realtime event list — parameter/ramp events append to
param_events and call store.set_value_rt, short MIDI arrives via
AURenderEventMIDI, and UMP (sysex7 and channel voice) arrives via
AURenderEventMIDIEventList. A host sends that second form only to a
unit that negotiates a MIDI protocol, so it is live exactly when the
Processor declares supports_ump — see "MIDI protocol negotiation" in the
gotchas below before assuming the sysex path runs at all.
The sorted param_events queue is attached to the processor via
set_param_events(¶m_events) before render, so
Processor::param_events() exposes the same sample offsets.
- Wraps the current main input, optional sidechain, and main output in a
stack-owned ProcessBuffers block, then calls the additive
processor->process(process_buffers, midi_in, midi_out, ctx) overload.
Legacy processors still run through the default projection; processors that
override the richer overload can inspect AUv3 bus metadata directly.
- Forwards any
midi_outevents back to the host via
self.MIDIOutputEventBlock (AU v3.1+). Each event's
sample_offset is added to timestamp->mSampleTime rounded to the nearest
sample (detail::au_event_sample_time).
The bypass short-circuit (before step 6, when shouldBypassEffect) must NOT
memcpy the dry input straight to the output. When the Processor reports a
non-zero latency the host has delay-aligned the wet path by that latency
(PDC), so a raw dry copy arrives latency samples early — comb-filtering on
parallel busses. Route it through boundary::render_bypass_passthrough
(adapter_boundary.hpp), sizing the AUBridge::bypass delay line to
reported_latency_samples(processor->latency_samples(), host_quirks) in
allocateRenderResources. A zero latency collapses to a straight passthrough.
The AU v3 render block can't be driven in stock CI (needs a live host), so the
bypass logic is covered by the shared test_adapter_boundary_parity.cpp
[bypass] fixture the helper is exercised through.
ctx.timing publishes the rounded timestamp->mSampleTime (when
kAudioTimeStampSampleTimeValid is set) as the steady counter and the
transportStateBlock position as the transport. allocateRenderResources and
the -reset override raise timing_discontinuity_pending (an atomic: both run
off the render thread). Every early return that skips the Processor (bypass,
failClosed, state-restore contention, a missing processor or output list,
the oversized-block rejection, and the multi-output block's own refusals) sets
timing_block_skipped; keep that true for any new early return, or a host
without a valid mSampleTime will see the skipped samples retimed onto a
contiguous window. -reset also bumps reset_generation, which the
multi-output cache compares before reusing a render: without it a host that
resets and renders the same time stamp again gets pre-reset audio and the
Processor never sees the reset.
MIDI eventSampleTime is a render-axis time, not an offset: it is either in
the AUEventSampleTimeImmediate window or absolute against mSampleTime.
Short MIDI and each AURenderEventMIDIEventList are placed with
format::admit_au_event_time() (the shared au_event_raw_offset() arithmetic)
and admitted against frameCount. An out-of-block time, or an absolute time
with no valid mSampleTime, is refused and counted on
ctx.timing.refused_events, never clamped. Parameter events still clamp through
au_event_block_offset(). A test that renders MIDI at mSampleTime = 0 cannot
tell an offset from an absolute time; use a non-zero block time. A refused time
may be a release the count cannot identify, so refused_event_reset_pending
makes the next render the Processor observes carry ctx.reset_requested and a
fresh MPE tracker; the bypass and state-restore returns keep the flag.
MPE routing
When a Processor declares supports_mpe, AU v3 feeds per-note expression the
same way CLAP/VST3 do — via the shared boundary::MpeSidecar (in
adapter_boundary.hpp), NOT a hand-rolled tracker. AUBridge owns one
boundary::MpeSidecar mpe;; configure() it at init, reserve()+reset() in
allocateRenderResources, reset() in deallocateRenderResources, and call
mpe.run(*processor, midi_in) in the render block right before
processor->process() and after the bypass early-return (a bypassed plugin
gets no MPE). AU delivers MIDI already time-ordered, so pass it in host order
(no sort) — matching CLAP. Non-MPE plugins get set_mpe_input(nullptr) each
block.
The sidecar is unreachable unless the unit says so. Logic (and every other
MPE-aware host) decides whether to route an MPE zone's per-member-channel
stream from the supportsMPE property; a unit that leaves it unanswered is
simply never offered MPE input, however complete its tracker. PulpAudioUnit
overrides -supportsMPE to return _bridge.mpe.enabled — the same descriptor
opt-in the render block gates on, so what the host is told and what the adapter
does cannot drift. The v2 bridge of the same property is
kAudioUnitProperty_SupportsMPE; keep both answering or an MPE plug-in works
in one adapter and not the other. Unlike bypass, MPE routing IS unit-tested headlessly: the AU v3 MPE case
in test_au_plugin_state.mm drives internalRenderBlock with a channel-wide
MIDI list and asserts per-note NoteOn/PitchBend/Timbre/Pressure routing.
State: `fullState` dictionary
fullState wraps store_.serialize() bytes inside an NSData keyed
@"pulpState" within the dictionary returned by super.fullState.
setFullState: reads @"pulpState" back, calls
store_.deserialize. The super call is intentional — AUAudioUnit
merges its own internal state (e.g. maximum frames to render) into the
dictionary, and the round-trip must preserve it.
Presets: `factoryPresets` + `currentPreset`
iOS hosts — AUM, Loopy Pro, Cubasis — drive presets exclusively
through this API, so an AUv3 that answers nothing here has no preset
UX at all on the platform Pulp ships to first.
factoryPresets builds AUAudioUnitPreset objects from the shared
FactoryPresetTable (au_factory_presets.hpp, the same table the
three AU v2 adapters serve GetPresets from), bound in
initWithComponentDescription:. It returns **nil, not an empty
array**, when the plug-in ships none — an empty array makes a host
draw an empty menu. The table is discovered from the loaded bundle, so
it is empty in any unit-test binary; a test stages a folder through
the Pulp-private pulpFactoryPresetTable accessor.
FactoryPresetTable::bind installs no content-preset source on its
PresetManager and sets no content plugin id, so the table lists factory and
user presets only. That keeps pulp-format free of a pulp-content link
(PULP_LINK_FLOOR_DEBT_* in tools/cmake/PulpLinkFloor.cmake would fail on
the edge); content-pack presets need both
set_content_preset_source(state::content_registry_preset_source()) and a
plugin id, installed by code that links pulp-content.
setCurrentPreset: implements Apple's documented split, and getting
it wrong is the trap here:
- number >= 0 — a factory preset. Load it from the table. It must
actually move StateStore values; a host that only sees the name
change will look like it is working.
- number < 0 — a user preset. Ask
super's
presetStateFor:error: and assign the result to fullState. Never
index the factory table with it.
supportsUserPresets therefore returns YES. Pulp owns no writable
preset store: userPresets, saveUserPreset:error:,
deleteUserPreset:error: and presetStateFor:error: all have
AUAudioUnit base-class implementations backed by a location Apple
manages, and fullState already round-trips the StateStore plus any
processor-owned payload. The two things a plug-in must supply are the
YES and the negative-number branch above.
Both branches are wrapped in
will/didChangeValueForKey:@"allParameterValues" — that pseudo-property
is how AUAudioUnit tells a host every parameter may have moved at once,
and currentPreset is one of the changes Apple names for it.
currentPreset's accessors are both overridden, so nothing is
synthesized and the ivar must be retained and released in -dealloc
(this file is MRR, not ARC). A rejected selection — an out-of-range
factory number, an unreadable user preset — must leave both the
parameters and the previously reported currentPreset untouched.
ARA companion factory
audioUnitARAFactory is a @property (readonly, nullable) void * —
the AU-host-observed KVO property that ARA-aware hosts (Logic Pro 11+)
read during scan. It returns
pulp::format::ara_companion_factory_for(nullptr), which is non-null
in PULP_HAS_ARA builds where a Processor overrode
create_ara_document_controller(). Keep this property KVO-visible; it
is the AU scan hook ARA-aware hosts inspect.
iOS AUv3 extension
AUv3 on iOS is a UIKit app extension. The view controller
(PulpAUViewController in au_view_controller_ios.mm) is
AUViewController-derived and builds a ViewBridge — from
ViewBridge::Options::hosted_editor(), never a hand-assembled Options; a
structural test enforces that every hosted adapter uses the factory — against
the extension's loaded AUAudioUnit once KVO fires on self.audioUnit. Extension principal class registration is via
NSExtensionMain-style Info.plist — see docs/guides/ios-auv3-guidance.md
and the ios skill for the extension target wiring.
pulp_add_ios_auv3(... UI <package>) attaches a UI package to the extension
(_pulp_attach_ui_package, as pulp_add_plugin does), so editor_factory() is
set and PulpAUViewController opens the contract view. It refuses at configure
when the package is not a target, when it needs shared runtime libraries, or
(for Vellum) when the Vellum SDK has no iOS slice; it never builds an editorless
extension for a UI that was asked for. test/cmake/test_ios_auv3_ui_package.cmake
covers each case and that omitting UI changes nothing.
iOS AUv3 spawn-chain gotchas
iOS AUv3 was historically "scaffolded but never actually loaded" — the
CMake helper and HostApp template both had multiple bugs that silently
prevented AVAudioUnit.instantiate from succeeding. The chain that has
to be right end-to-end:
.appexbinary type must beMH_EXECUTE, notMH_BUNDLE.
add_library(... MODULE ...) produces MH_BUNDLE. PluginKit's
posix_spawn rejects bundles with **ENOEXEC ("Exec format
error"), surfaced to the host as OSStatus 4** from
AVAudioUnit.instantiate. Fix in tools/cmake/PulpAuv3.cmake
_pulp_add_auv3_ios:
```cmake
add_executable(${target}_AUv3 ...)
target_link_options(${target}_AUv3 PRIVATE
"-e" "_NSExtensionMain" "-fapplication-extension")
set_target_properties(${target}_AUv3 PROPERTIES
XCODE_PRODUCT_TYPE "com.apple.product-type.app-extension"
XCODE_ATTRIBUTE_WRAPPER_EXTENSION "appex"
BUNDLE TRUE BUNDLE_EXTENSION "appex"
RUNTIME_OUTPUT_DIRECTORY "...")
```
Verify with file <appex>/<exec> — must say Mach-O 64-bit executable,
NOT Mach-O 64-bit bundle.
- HostApp must use
.loadOutOfProcesson iOS. The default
in-process load is unsupported for AUv3 extensions on iOS;
AVAudioUnit.instantiate(with: desc, options: []) returns OSStatus 4.
Use .loadOutOfProcess (Apple's "Incorporating Audio Effects and
Instruments" sample documents this in a comment).
- **HostApp's
AudioComponentDescriptionfilter must match the
extension exactly.** The shipped template literally filtered for
kAudioUnitType_Effect + subtype Pu_E — would never find any
instrument plug-in. Plug-in authors copying the template must update
the four-CC values to match their own AUv3's Info.plist
AudioComponents entry. Better fix: derive these from
AVAudioUnitComponentManager.components(matching:) against a
permissive description.
- **Embedded
.appexbundle ID must be a child of the HostApp's bundle
ID.** Apple enforces parent-child: extension bundle ID must START
with the containing app's bundle ID + . + suffix. Otherwise install
fails with "Mismatched bundle IDs". The Pulp helper derives the
.appex bundle ID from the AUv3 target's BUNDLE_ID — plug-in
authors must set that arg to a child of the HostApp's bundle ID, not
to a sibling (and not equal to it). On iOS this is now enforced at
configure time: pulp_add_ios_host_app (tools/cmake/PulpIosHostApp.cmake)
FATAL_ERRORs ("must be nested under") if the extension id is not
strictly nested under the host id, so the mistake surfaces before any
build instead of at xcrun simctl install. Regression test:
test/cmake/test_ios_hostapp_bundle_guard.sh.
- **HostApp entitlements containing
com.apple.security.application-groups
require an explicit (non-wildcard) App ID with App Groups capability
enabled in Apple Developer**. Wildcard App IDs cannot use App Groups.
For pure plug-in development testing, strip the entitlement.
- Instruments (aumu) need MIDI to make sound. Discovery + load is
not enough; the host must call audioUnit.scheduleMIDIEventBlock
with a noteOn byte sequence (0x90, <key>, <vel>). Apple's
SimplePlayEngine.InstrumentPlayer is the reference. Without this,
engine.start() succeeds but the synth sits silently waiting for
MIDI input.
- Simulator PluginKit caches stale registrations between launches.
After a successful INSTANTIATE_OK once, a terminate + relaunch
without uninstall + install may flip to INSTANTIATE_ERROR Code=4
because PluginKit's database points at the old install UUID. **Real
device audio validation is authoritative; Sim is for build/discovery
smoke only.**
- iOS device requires
inter-app-audioentitlement on the HostApp
for AVAudioUnitComponentManager.components(matching:) to enumerate
AUv3 extensions on iOS 11+. Without it, the manager returns an empty
match list and your AUv3 appears invisible — even though pkd
indexed it correctly and xcrun devicectl device install app
succeeded. The iOS Simulator does NOT enforce this, so the missing
entitlement is silent until you try a real device. Fix in two places:
(a) one-time portal: enable Inter-App Audio on your wildcard
com.<you>.pulpdev.* App ID; Xcode auto-fetches the regenerated
profile on next build, (b) entitlements file: the shipped
templates/ios-auv3/HostApp/Entitlements.plist.in already includes
<key>inter-app-audio</key><true/>. Verify with
codesign -d --entitlements :- HostApp.app | plutil -p - →
"inter-app-audio" => 1. Apple deprecated IAA in iOS 13 (no new
IAA-only plug-ins on the Store) but the entitlement still gates
AUv3 host scanning — do not strip it. Full setup in
docs/guides/ios-dev-signing.md.
iOS AUv3 diagnostic recipe
When the HostApp shows "(no AUv3 found)" or instantiate fails silently:
// Drop these prints into ContentView.discover():
let components = AVAudioUnitComponentManager.shared().components(matching: desc)
print("PULP_DISCOVER: matching=\(components.count) type=\(...) sub=\(...) mfr=\(...)")
let all = AVAudioUnitComponentManager.shared().components(matching: AudioComponentDescription())
print("PULP_DISCOVER_ALL: \(all.count) total")
for c in all where c.manufacturerName == "Pulp" { print("PULP_DISCOVER_ALL_PULP: \(c.name)") }
AVAudioUnit.instantiate(with: desc, options: .loadOutOfProcess) { node, error in
if let e = error { print("PULP_INSTANTIATE_ERROR: \(e)") }
guard let node = node else { return }
print("PULP_INSTANTIATE_OK: \(node.auAudioUnit.componentName ?? "?")")
}
Then launch via XcodeBuildMCP launch_app_sim (returns runtimeLogPath
capturing stdout); grep PULP_ <runtimeLogPath> shows the chain.
If matching=0 → check #3 (descriptor mismatch).
If matching=N but INSTANTIATE_ERROR Code=4 →
- Check #1 (
file <appex>/<exec>saysbundlenotexecutable). - Check #2 (
options: []instead of.loadOutOfProcess). - Check spawn errors: `xcrun simctl spawn booted log show --last 30s
--predicate 'eventMessage CONTAINS "PulpSineSynth" AND (eventMessage
CONTAINS "Exec format" OR eventMessage CONTAINS "posix_spawn")'`.
iOS AUv3 audio validation
Simulator does NOT capture audio in simctl io booted recordVideo
(video-only). For audio verification you need either:
- Real device + headphones / mic capture
- Sim audio loopback via a Mac audio routing tool (BlackHole, Loopback)
- Or accept that "PULP_INSTANTIATE_OK + PULP_NOTE: ON + engine.start
succeeded" proves the wiring; trust the synth code path that's
already tested at the unit level
Two CMake entry points: keep signatures in lockstep
pulp_add_plugin(...) (the general entry) and pulp_add_ios_auv3(...)
(the iOS-extension wrapper) both end up calling the internal
`_pulp_add_auv3(target name bundle_id version manufacturer category
plugin_code manufacturer_code accepts_midi)` helper with positional
arguments. When you add or remove an arg on _pulp_add_auv3, you
must update BOTH wrappers — a missed update on the iOS wrapper
surfaces as:
CMake Error at tools/cmake/PulpUtils.cmake:<line> (_pulp_add_auv3):
_pulp_add_auv3 Function invoked with incorrect arguments
only on the iOS toolchain configure, because the other leg
(pulp_add_plugin) never exercises the wrapper. Adding
ACCEPTS_MIDI to _pulp_add_auv3 without threading it through
pulp_add_ios_auv3 is the representative failure mode; the
Coverage-macOS lane catches this class of mismatch because it
configures the iOS wrapper path.
macOS AU v3 packaging — framework + stub .appex + container .app
**Apple's architecture, not a Pulp invention. Get this wrong and you
will spend an entire session debugging silent Pluginkit rejections.**
Apple's "Creating custom audio effects" sample doc states verbatim:
"Your extension's main binary cannot be dynamically loaded into
another app, which means all executable AU code must reside in a
separate framework bundle. The extension target still needs to
contain at least one source file for the extension binary to be
created, properly loaded, and linked with the framework bundle."
That constraint is what forces the 3-tier shape. Pulp's macOS AU v3 lane
(tools/cmake/PulpAuv3.cmake's _pulp_add_auv3_macos_* helpers,
on the macOS framework path) implements it:
ChainerSynth.app/ ← container .app
├── Contents/
│ ├── MacOS/ChainerSynth ← tiny Cocoa shell, launched once to register
│ ├── PlugIns/
│ │ └── ChainerSynth.appex/ ← stub .appex (NSExtensionMain entry)
│ │ └── Contents/
│ │ ├── Info.plist
│ │ │ • NSExtensionPointIdentifier = com.apple.AudioUnit-UI
│ │ │ • NSExtensionPrincipalClass = PulpAUMacViewController
│ │ │ • NSExtensionAttributes.AudioComponentBundle =
│ │ │ <bundle-id>.AUv3Framework ← MUST match framework's CFBundleIdentifier
│ │ └── MacOS/ChainerSynth ← ~50KB stub binary, links framework
│ └── Frameworks/
│ └── ChainerSynthAUv3Framework.framework/ ← REAL code lives here
│ ├── Info.plist (CFBundlePackageType=FMWK)
│ └── Versions/A/
│ ├── ChainerSynthAUv3Framework ← contains PulpAudioUnit + PulpAUMacViewController
│ └── libwgpu_native.dylib ← any embedded dylibs
iOS is different — iOS AU v3 still uses the monolithic .appex. The
framework split is macOS-specific because of Apple's loadInProcess
out-of-process requirement on macOS. pulp_add_ios_auv3() stays on the
legacy monolithic path; pulp_add_plugin(FORMATS AUv3) dispatches to
the macOS framework path on macOS.
What goes in the framework vs the .appex stub
- Framework (
_pulp_add_auv3_macos_framework): the per-plugin
Core OBJECT lib + au_adapter.mm (PulpAudioUnit) +
au_view_controller_mac.mm (PulpAUMacViewController +
AUAudioUnitFactory) + per-plugin au_v3_entry.cpp (the
PULP_AUV3_PLUGIN macro that registers the processor factory).
- Stub .appex (
_pulp_add_auv3_macos_appex): a generated 1-function
.mm source — void Pulp_<plugin>_AUv3_keep_alive(void). Entry
point is Apple-provided _NSExtensionMain; we pass
-e _NSExtensionMain and -fapplication-extension. The stub links
the framework with -Wl,-force_load,$<TARGET_FILE:framework> so its
Obj-C classes register with the runtime — without -force_load,
NSClassFromString(@"PulpAUMacViewController") returns nil and the
host fails to instantiate the AU.
- Container .app (
_pulp_add_auv3_macos_host): tiny Cocoa shell
with a "this is the registration host" placeholder window. Bundle ID
<plugin-bundle-id>.AUv3Host. The user runs it once after install
to trigger Launch Services scan.
pulp-build-info.json (the build-identity record every bundle carries; see
the ship skill) goes into the .appex (format AUv3) and the container
.app (format AUv3Host), never the framework: _pulp_attach_build_info
skips FRAMEWORK targets because a Contents/Resources directory at a
framework root is an unsealed-root codesign failure. pulp_add_ios_auv3()
bypasses pulp_add_plugin(), so it attaches the record itself — keep that
call when editing either entry point.
On iOS the .appex and host .app are shallow bundles: the record goes at the
bundle root, never under a Resources/ directory. A top-level Resources/ in a
shallow bundle makes codesign reject the whole extension ("bundle format
unrecognized", or the root JSON sidecars reported as unsigned code) — Xcode's
CodeSign step fails and the extension cannot be installed. Builds with
CODE_SIGNING_ALLOWED=NO (the iOS compile gate) never see it, so the gate signs
the extension ad hoc with tools/scripts/check_apple_bundle_signing.sh. Do not
switch that check to codesign --deep: --deep signs data files it mistakes for
code through extended attributes and hides the failure. pulp.plugin-runtime.json
(content-kind plug-ins) follows the same rule (PulpInstall.cmake). The
build-info finalize step deletes Pulp's own records from an old top-level
Resources/ and removes the directory once it is empty, so existing build trees
heal without a clean.
**Do NOT put au_entry.mm's PulpAUFactoryObj (legacy
AudioComponentRegister factory C function) anywhere in the macOS AU v3
lane.** The macOS path uses _NSExtensionMain + NSExtensionPrincipalClass
to find the factory class.
rpath: 4 levels up, not 2
The .appex's binary at
MyApp.app/Contents/PlugIns/MyApp.appex/Contents/MacOS/MyApp needs to
find the framework at MyApp.app/Contents/Frameworks/. From the
binary, that's 4 parent dirs up (`MacOS → Contents → MyApp.appex →
PlugIns → Contents → Frameworks`):
set_target_properties(${appex_target} PROPERTIES
INSTALL_RPATH "@executable_path/../../../../Frameworks")
@executable_path/../../Frameworks is the tempting wrong answer — it
suits iOS's flat .appex layout, but breaks on macOS, where the .appex has
its own Contents/MacOS/ and sits one bundle deeper. An rpath recipe
carried over from an iOS lane will resolve inside the .appex and the
framework silently fails to load.
The container .app's binary at MyApp.app/Contents/MacOS/MyApp needs
2 parent dirs up: INSTALL_RPATH "@executable_path/../Frameworks".
Signing + notarization is mandatory on Sequoia/Tahoe
macOS Tahoe's Pluginkit silently rejects ad-hoc-signed, Developer-ID-
signed-without-notarization, and even properly Developer-ID-signed but
unnotarized AU v3 .appex bundles. pluginkit -mAvvv -p com.apple.AudioUnit-UI
returns "no matches" with zero log diagnostics. The only signal you
get is the absence of the plugin.
You MUST:
- Sign embedded dylibs first (
libwgpu_native.dylib, etc.) with
--timestamp --options runtime and the same Developer ID identity
- Sign the framework
- Sign the .appex with
--entitlements <sandbox>.plist(the
com.apple.security.app-sandbox entitlement is REQUIRED for app
extensions; without it pkd logs "plug-ins must be sandboxed" and
rejects). Use the build's rendered
build/AUv3/<target>_AUv3.entitlements: PulpAuv3Entitlements.cmake
emits com.apple.security.cs.allow-jit only for PULP_JS_ENGINE=v8
or jsc (QuickJS, Skia and Dawn need no executable memory), never
emits allow-unsigned-executable-memory (V8/JSC use MAP_JIT, which
allow-jit covers), and emits disable-library-validation only when
-DPULP_AUV3_DISABLE_LIBRARY_VALIDATION=ON. Library validation admits
code signed by Apple or by the host's own Team ID, so the inner-out
same-identity recipe here passes without it; turn it on only for a
vendor-signed prebuilt dylib you cannot re-sign, or an ad-hoc
(codesign -s -) dev build whose components carry no Team ID. The
old unconditional trio let any signed-by-anyone dylib load into the
extension. Gotcha: pulp ship sign / ship share refuse to sign an
app or appex of a v8/jsc build whose entitlements grant no
allow-jit (they read PULP_JS_ENGINE from the build's
CMakeCache.txt), because such a bundle signs fine and then fails the
instant the editor starts the engine. Plug-in bundles are exempt; they
run under the host's entitlements.
- Sign the container .app with the rendered
build/AUv3/<target>_AUv3Host.entitlements (same per-engine policy;
the host opens the AU UI in-process so it needs allow-jit exactly
when the appex does)
- Notarize the container .app via `xcrun notarytool submit
--apple-id <id> --team-id <team> --password <app-specific-pwd>
--wait`
- Staple with
xcrun stapler staple - Install to /Applications and
lsregister -f -R - Open the container .app once to trigger Launch Services scan
→ Pluginkit then registers the embedded extension
The full recipe is in tools/scripts/sign-notarize-auv3-mac.sh.
For the reusable dev-signing cred layout that step 5 consumes
(PULP_TEAM_ID / PULP_NOTARY_*), see