AudioUnit new project template for Xcode 5/6/7
I finally got around to this: When apple updated past the first version of Xcode 4, they pulled the AudioUnit new project templates and never replaced them. This led to much pain and gnashing of teeth on the part of developers and would-be developers looking into AudioUnits for the first time. So with much pain and annoyance, I spent the weekend updating their ‘most recent’ AudioUnit effect template to make them compatible with the most recent Xcode versions (as well as making a few personal changes).
I included those instructions in a readme file with the archive, but let me explain here in greater detail. This should build a working project right out of the box after these three steps:
1) Download the template: http://www.solamors.com/ACK_Audio_Unit_Effect_Cocoa_UI.zip
2) Drop this template in either ‘home/Library/Developer/Xcode/Templates’ or ‘/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates’
3) Make sure to have Apple’s Core Audio Utility classes’ “CoreAudio” folder in the top level of your developer directory — the default now is in the Xcode.app: /Applications/Xcode.app/Contents/Developer/… . (You can alternatively change the path to the source files in the *.xctemplate if you prefer a different location).
Now you are good to go! Here is the result:
USING THIS TEMPLATE:
Make a new project:
Select our new template:
and set our options:
“Product Name:” will be both our project and product name.
“Organization Name:” is either your name or your company.
“Organization Identifier:” is your 4-char manufacturer code from Apple (just make it up if you don’t have one, just make sure that it is 4 letters.
“Subtype:” is the unique 4-char identifier for you plugin. Make sure it is UNIQUE to each plugin.
You will be presented with a window something like this:
You can see that it is a very simple structure, with all the relevant files in the main directory. I tried not to obscure anything important or convolute the code with too many options. I added localized project strings and version plists to the template directory for convenience, but I did not include them in the default build. Those can be added to the project to *.xctemplate plist if you wish.
Since I left MOST of the options at the Apple default values, you may want to change them to suit you. If left as-is, it will build with the most recent SDK in 64-bit mode only, and without ARC. I modified the template to provide legacy support for 32-bit and the carbon component manager resource, just because I like supporting older gear where possible. However, I did not try any of the PowerPC SDKs because I don’t have a machine to test them on… sorry.
The default build location is the DerivedData folder. If you wish, you can add a script build phase to move the build to your plunges folder. This is the script that I use:
rm -rf $HOME/Library/Audio/Plug-Ins/Components/$PRODUCT_NAME.component
cp -r “$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.component” “$HOME/Library/Audio/Plug-Ins/Components/$PRODUCT_NAME.component”
Simply click the + to add a script phase:
Then past the script:
In the near future, I will write a blog on customizing the template, but for now… Happy coding!
(UPDATE 12/2015: confirmed working in Xcode 7.2)