Audio Unit v2 Platform API
The Audio Unit v2 (AUv2) implementation provides complete integration with Apple’s Audio Unit framework for macOS plugins.Overview
TheIPlugAU class implements the AudioUnit v2 API, using Apple’s Component Manager and Audio Component architecture. It provides full support for Audio Unit properties, parameters, and rendering.
AUv2 is the legacy Audio Unit format for macOS. While still widely supported, Apple recommends AUv3 for new development. iPlug2 supports both formats.
Core Class
IPlugAU
Defined in:IPlug/AUv2/IPlugAU.h
- Audio Unit component management
- Property and parameter handling
- Audio rendering and bus connections
- MIDI input/output
- State serialization
Key Methods
Host Communication
BeginInformHostOfParamChange
idx- Parameter index
InformHostOfParamChange
idx- Parameter indexnormalizedValue- Normalized parameter value (0.0 to 1.0)
EndInformHostOfParamChange
idx- Parameter index
InformHostOfPresetChange
MIDI
SendMidiMsg
msg- MIDI message to send
true if message was sent successfully
SendMidiMsgs
msgs- Buffer of MIDI messages
true if messages were sent successfully
SendSysEx
msg- SysEx message to send
true if message was sent successfully
Processing
SetLatency
samples- Latency in samples
PreProcess
ResizeScratchBuffers
Track Information
GetTrackName
str- String to receive track name
Track name support varies by host. Logic Pro and GarageBand provide this information.
Specialized Methods
GetLastAudioTimeStamp
Specialist Use: This method is primarily for hosting Audio Units within Audio Units. Thread safety: returns a snapshot that may be stale if called off the audio thread.
Audio Unit Properties
The IPlugAU class handles these key Audio Unit properties:Property Methods
GetPropertyInfo
propID- Property identifierscope- Property scope (global, input, output)element- Element index (bus number)pDataSize- Receives size of property datapWriteable- Receives whether property is writable
noErr on success, error code otherwise
GetProperty
propID- Property identifierscope- Property scopeelement- Element indexpDataSize- Size of data buffer / receives actual sizepWriteable- Receives whether property is writablepData- Buffer to receive property data
noErr on success
SetProperty
propID- Property identifierscope- Property scopeelement- Element indexpDataSize- Size of property datapData- Property data
noErr on success
Bus Configuration
Bus Types
AUv2 supports multiple input and output buses with different connection types:Bus Management
GetBus
scope- Input or output scopebusIdx- Bus index
CheckLegalIO
scope- Bus scopebusIdx- Bus indexnChannels- Number of channels
true if configuration is valid
State Management
GetState
ppPropList- Receives property list containing state
noErr on success
SetState
pPropList- Property list containing state
noErr on success
Factory Template
IPlugAUFactory
Plug- Your plugin classMIDIIn- Whether plugin receives MIDI input
Construct()- Creates plugin instanceDestruct()- Destroys plugin instanceLookup()- Resolves Audio Unit method selectorsOpen()- Opens Audio Unit instanceClose()- Closes Audio Unit instanceFactory()- Main factory function
Configuration
AUv2 Configuration Options
Set in your plugin’sconfig.h:
Audio Unit Type Codes
Effect
kAudioUnitType_Effect (aufx)Instrument
kAudioUnitType_MusicDevice (aumu)MIDI Effect
kAudioUnitType_MIDIProcessor (aumi)Offline
kAudioUnitType_OfflineEffect (auol)Factory Function
MakePlug
memory- Pre-allocated memory for plugin instance
AUv2 uses placement new to construct plugins in pre-allocated memory for efficient instantiation.
Best Practices
Property Listeners
Support property change listeners to notify hosts of parameter and state changes using
InformListeners().Bus Connections
Handle all bus connection types properly. Check
mInputType to determine connection method.MIDI Output
Register MIDI output callback early in initialization if your plugin sends MIDI.
Channel Layouts
Support multiple channel layout tags for flexibility across hosts and configurations.
Common Issues
Related Documentation
- AUv3 Platform API - Modern Audio Unit format
- IPlugAPIBase - Base API functionality
- IPlugProcessor - Audio processing interface
- Audio Unit Programming Guide - Apple’s official documentation