Audio Unit AUPlugIn - Updating an existing Audio Unit for OS X Lion and later
When updating audio units for Mac OS X Lion or later there are a number of changes that must be made to your Xcode project for the audio unit to build and run on the system. Once these changes are in place, the audio unit will build and run in Mac OS X Lion and also run when deployed in Mac OS X v10.6.x.
This technical note discusses these changes using the FilterDemo audio unit sample code project as an example.
Overview
Mac OS X Lion introduces a new plug-in model called AUPlugIn
which is no longer based on the Component Manager. The AUPlugIn
model has a new dispatch mechanism requiring the inclusion of two new dispatch helper files called AUPlugInDispatch.h
and AUPlugInDispatch.cpp
respectively.
A new AUDIOCOMPONENT_ENTRY()
macro has been added to ComponentBase.h
and by using this macro audio unit entry points are created for both the audio unit plug-in for Mac OS X Lion and the Component Manager component for backwards compatibility with Mac OS X v10.6.x.
Because audio units no longer use the Component Manager on Mac OS X Lion or newer, AUPlugIn
based audio units do not use resource files (.r
files) or the 'thng
' resource to define properties such as kComponentType
, kComponentSubType
, and kComponentManufactureType
. These properties are now specified in the project's Info.plist
file for the audio unit. You can continue to include the Component Manager resource file in the project for backwards compatibility with Mac OS X v10.6.x.
The new AUPlugIn
entry point generated by the AUDIOCOMPONENT_ENTRY()
macro is required and must be added to the exports file (.exp
). You can leave the Component Manager entry point in the exports file to provide backwards compatibility with Mac OS X v10.6.x.
Example: Updating the FilterDemo Audio Unit
Download the FilterDemo Audio Unit sample and walk though the following update steps. Mac OS X Lion and the associated Xcode tools are required.
Open the file
Filter.cpp
and replaceCOMPONENT_ENTRY(Filter)
withAUDIOCOMPONENT_ENTRY(AUBaseFactory,
Filter)
. This is the new macro that generates the plugin entry for the audio unit. See Listing 1.Add the new entry point called
_FilterFactory
to theFilter.exp
file._FilterFactory
is generated by theAUDIOCOMPONENT_ENTRY()
macro. Leave_FilterEntry
for backwards compatibility. See Listing 2.Add an
AudioComponents
dictionary to theInfo.plist
file. Audio unit plugins do not use resource files to define their properties, therefore these items now need to be specified in theInfo.plist
file. Note that the resource file (Filter.r
) should be left in place for backwards compatibility. See Listing 3 and Figure 1.Add the
AUPlugInDispatch.h
andAUPlugInDispatch.cpp
files to the project. These dispatch helper files are located inDeveloper/Extras/CoreAudio/AUPublic/AUBase
and are required by theAUPlugIn
manager. See Figure 2.
Listing 1 Change entry point generation macro in Filter.cpp
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
// Standard DSP AudioUnit implementation |
// old component manager entry point no longer required |
//COMPONENT_ENTRY(Filter) |
// new AUPlugIn macro |
AUDIOCOMPONENT_ENTRY(AUBaseFactory, Filter) |
Listing 2 Add new entry point in Filter.exp
_FilterEntry |
_FilterFactory |
Listing 3 AudioComponents
array in the Info.plist
file.
<key>AudioComponents</key> |
<array> |
<dict> |
<key>description</key> |
<string>Filter AU</string> |
<key>factoryFunction</key> |
<string>FilterFactory</string> |
<key>manufacturer</key> |
<string>Acme</string> |
<key>name</key> |
<string>Apple Demo: Filter</string> |
<key>subtype</key> |
<string>FILT</string> |
<key>type</key> |
<string>aufx</string> |
<key>version</key> |
<integer>65536</integer> |
</dict> |
</array> |
Document Revision History
Date | Notes |
---|---|
2012-08-17 | Fixed plist information |
2012-05-09 | Editorial |
2011-09-30 | Fixed plist information |
2011-08-22 | Editorial |
2011-05-23 | New document that discusses required audio unit project changes for building and running on OS X Lion (and v10.6.x). |
Copyright © 2012 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2012-08-17