au_view.h
The Audio Unit editor.
#include <sonore/au_view.h>- 1type
- 5other declarations
- Guides: Getting started, Platforms and formats
On this page
Design notes
Compiled on macOS since 2026-09-01 (the SDK workflow builds it beside the AU), but never OPENED: auval validates the unit and does not instantiate its CocoaUI, and no macOS test attaches an editor yet. Treat the view as unrun until a host on a Mac has shown it.
An AU host asks for kAudioUnitProperty_CocoaUI, gets the NAME of an Objective-C class, instantiates it, and calls uiViewForAudioUnit:withSize: expecting an NSView back. There is no such class in any framework, so one is REGISTERED AT RUNTIME here, the same technique webview_cocoa.h uses for its script-message handler, and the reason this SDK needs no .mm file anywhere.
The view it returns is the same WKWebView every other format shows, wired to the same window.sonore bridge.
Types 1
Registered from a static initialiser, so the class exists before any host can ask for it: a lazily-registered class loses the race with a fast host.
Functions 5
- fn
inline Unit* unitFromAudioUnit(void* audioUnit)The Unit behind a host's AudioUnit handle. The handle is an OPAQUE wrapper owned by the AudioComponent framework. Casting it (an earlier version did) dereferences framework internals and crashes. The sanctioned route from a Cocoa view back to its instance is a property read, which the framework routes to our own getProperty.au::unitFromAudioUnit · au_view.h:39 - fn
inline void viewOnMessage(Unit* unit, const BridgeMessage& message)A UI edit, on the main thread.au::viewOnMessage · au_view.h:57 - fn
inline void viewTick(Unit* unit)The ~30 Hz editor clock: push what the page does not know yet.au::viewTick · au_view.h:151 - fn
inline id viewForAudioUnit(id /*self*/, SEL, void* audioUnit, cocoa::CGSizeStruct size)au::viewForAudioUnit · au_view.h:165uiViewForAudioUnit:withSize:, the one method AUCocoaUIBase requires. - fn
inline Class registerViewFactory()Register the factory class once. The name must match the string returned for kAudioUnitProperty_CocoaUI, or the host looks up a class that isn't there and silently shows its generic sliders instead.au::registerViewFactory · au_view.h:223