Now you create and configure an Xcode project for your audio unit. This section may seem long—it includes many steps and screenshots—but after you are familiar with the configuration process you can accomplish it in about five minutes.
Launch Xcode and follow these steps:
1. Choose File > New Project
2. In the New Project Assistant dialog, choose the Audio Unit Effect template and click Next.

3. Name the project TremoloUnit and specify a project directory. Then click Finish.

Xcode creates the project files for your audio unit and the Xcode project window opens.
At this point, Xcode has used the audio unit project template file to create a subclass of the AUEffectBase class. Your custom subclass is named according to the name of your project. You can find your custom subclass’s implementation file, TremoloUnit.cpp, in the AU Source group in the Xcode Groups & Files pane, shown next.

In later steps, you'll edit methods in your custom subclass to override the superclass’s methods. TremoloUnit.cpp also contains a couple of methods from the AUKernelBase helper class; these are the methods that you later modify to perform digital signal processing.
4. With the AU Source group open as shown in the previous step, click TremoloUnitVersion.h. Then click the Editor toolbar button, if necessary, to display the text editor. There are three values to customize in this file: kTremoloUnitVersion, TremoloUnit_COMP_SUBTYPE, and TremoloUnit_COMP_MANF.
Scroll down in the editing pane to the definitions of TremoloUnit_COMP_SUBTYPE and TremoloUnit_COMP_MANF. Customize the subtype field with the four-character subtype code that you've chosen. In this example, 'tmlo' indicates (to developers and users) that the audio unit lets a user add tremolo.

Also customize the manufacturer name with the unique four-character string that identifies your company.
Note: There is no #define statement for component type in the TremoloUnitVersion.h file because you specified the type—effect unit—when you picked the Xcode template for the audio unit. The audio unit bundle type is specified in the AU Source/TremoloUnit.r resource file.
Now set the version number for the audio unit. In the TremoloUnitVersion.h file, just above the definitions for subtype and manufacturer, you’ll see the definition statement for the kTremoloUnitVersion constant. By default, the template sets this constant’s value to 1.0.0, as represented by the hexadecimal number 0x00010000. Change this, if you like. See “Audio Unit Identification” for how to construct the hexadecimal version number.
Save the TremoloUnitVersion.h file.
5. Click the TremoloUnit.r resource file in the "Source/AU Source" group in the Groups & Files pane. There are two values to customize in this file: NAME and DESCRIPTION.
NAME is used by the generic view to display both your company name and the audio unit name
DESCRIPTION serves as the menu item for users choosing your audio unit from within a host application.
To work correctly with the generic view, the value for NAME must follow a specific pattern:
<company name>: <audio unit name> |
For this example, use:
Angry Audio: Tremolo Unit
If you have set your company name using the Xcode expert preference as described earlier, it will already be in place in the NAME variable for this project; to follow this example, all you need to do is add a space between Tremolo and Unit in the audio unit name itself.
The Xcode template provides a default value for DESCRIPTION. If you customize it, keep it short so that the string works well with pop-up menus. The figure shows a customized DESCRIPTION.

As you can see in the figure, the resource file uses a #include statement to import the Version header file that you customized in step 4, TremoloUnitVersion.h. The resource file uses values from that header file to define some variables such as component subtype (COMP_SUBTYPE) and manufacturer (COMP_MANUF).
Save the TremoloUnit.r resource file.
6. Open the Resources group in the Groups & Files pane in the Xcode project window, and click on the InfoPlist.strings file.

Using the editor, customize the value for CFBundleGetInfoString using the value you’ve chosen for the audio unit brief description. The figure provides an example. This string appears in the Version field of the audio unit bundle’s Get Info window in the Finder. Save the InfoPlist.strings file.
7. Open the Targets group in the Groups & Files pane in the Xcode project window. Double-click the audio unit bundle, which has the same name as your project—in this case, TremoloUnit.

The Target Info window opens. Click the Properties tab.

In the Target Info window’s Properties tab, provide values for Identifier, Creator, Version, and, optionally, a path to a Finder icon file for the bundle that you place in the bundle’s Resources folder.
The audio unit bundle identifier field should follow the pattern:
com.<company_name>.audiounit.<audio_unit_name>
For this example, use the identifier:
com.angryaudio.audiounit.TremoloUnit
For the Creator value, use the same four-character string used for the manufacturer field in step 4.
Xcode transfers all the information from the Properties tab into the audio unit bundle’s Info.plist file. You can open the Info.plist file, if you'd like to inspect it, directly from this dialog using the "Open Info.plist as File" button at the bottom of the window.
When finished, close the Info.plist file (if you've opened it) or close the Target Info window.
8. Now configure the Xcode project’s build process to copy your audio unit bundle to the appropriate location so that host applications can use it.
In the project window, disclose the Products group and the Targets group, as shown in the figure, so that you can see the icon for the audio unit bundle itself (TremoloUnit.component) as well as the build phases (under Targets/TremoloUnit).

9. Now add a new build phase. Right-click (or control-click) the final build phase for TremoloUnit and choose Add > New Build Phase > New Copy Files Build Phase.

The new Copy Files build phase appears at the end of the list, and a dialog opens, titled Copy Files Phase for "TremoloUnit" Info.

Change the Destination pop-up to Absolute Path, as shown in the figure.
Enter the absolute destination path for the built audio unit bundle in the Full Path field.
Note: The copy phase will not work if you enter a tilde (~) character to indicate your home folder. In Xcode 2.4, the Full Path field will let you enter a path by dragging the destination folder into the text field only if you first click in the Full Path field.
You can use either of the valid paths for audio unit bundles, as described in “Audio Unit Installation and Registration.” With the full path entered, close the dialog.
Now drag the TremoloUnit.component icon from the Products group to the new build phase.

You can later change the Copy Files location, if you want, by double clicking the gray Copy Files build phase icon. Alternatively, click the Copy Files icon and then click the Info button in the toolbar.
At this point, you have have the makings for a working audio unit. You have not yet customized it to do whatever it is that you’ll have it do (in our present case, to provide a single-channel tremolo effect). It’s a good idea to ensure that you can build it without errors, that you can validate it with the auval tool, and that you can use it in a host application. Do this in the next step.
10. Build the project. You can do this in any of the standard ways: click the Build button in the toolbar, or choose Build from the Build button's menu, or choose Build > Build from the main menu, or type command-B.

If everything is in order, your project will build without error.
The copy files build phase that you added in the previous step ensures that a copy of the audio unit bundle gets placed in the appropriate location for the Component Manager to find it when a host application launches. The next step ensures that is so, and lets you test that it works in a host application.
Last updated: 2007-10-31