AudioUnits compilation tips

To compile Audio Units with the OWLSim:

1). Download the Core Audio Utility Classes from:
http://developer.apple.com/library/ios/#samplecode/CoreAudioUtilityClasses/
Introduction/Intro.html

2). Move the CoreAudio folder to:
/Library/Developer/CoreAudio

3). Create a symlink to:
/Applications/Xcode.app/Contents/Developer/Extras/

Be sure to use the Juce forums if you get stuck - there’s a lot of info. there
about getting AU’s to compile:

http://www.rawmaterialsoftware.com/
http://rawmaterialsoftware.com/viewtopic.php?f=8&t=9546&p=56679#p56677

4). Make an new group folder in your XCode project called something like AU
wrapper folder, and put this in your Juce Library Code group. Add the necessary
CA files (you don’t need all of these to compile AU’s successfully - look at the juce
demo plugin project).

(It’s also a good idea to add these files in the Introjucer project in case the
project has to be rebuilt for any reason).

5). Make sure you are building against these frameworks (these can also be added
in the Introjucer under Extra Frameworks):

AudioToolbox, AudioUnit, CoreAudio, CoreAudioKit

6). Set Header Search Paths in XCode:

~/SDKs/vstsdk2.4
…/…/JuceLibraryCode
$(DEVELOPER_DIR)/Extras/CoreAudio/PublicUtility
$(DEVELOPER_DIR)/Extras/CoreAudio/AudioUnits/AUPublic/Utility
$(DEVELOPER_DIR)/Extras/CoreAudio/AudioUnits/AUPublic/AUBase $(inherited)

7). Set Other Rez Flags in XCode:

-d
ppc_$ppc
-d
i386_$i386
-d
ppc64_$ppc64
-d
x86_64_$x86_64
-l
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers
-l
“$(DEVELOPER_DIR)/Extras/CoreAudio/AudioUnits/AUPublic/AUBase”

Rez errors that you might encounter:

Rez exit code 2 : in Build phases only have the juce AUResources.r file - delete
the other one!

Rez exit code 3 : Make sure that the Other Rez flags are set correctly.

Hi Tom,

Thanks for the pointers. Writing stuff down for the benefit of anyone else who might try to do the same.

I’d done 1,2 and 3.
5 - good point, AudioUnit and CoreAudioKit weren’t included in Target->OwlSim->Build Phases->Link Binary With Libraries so I added them (did “Add Other…”->navigate to /System/Library/Frameworks/ and add the folders).
6 - I had /Library/Developer/CoreAudio/** (recursive) instead of the three CoreAudio directories, I guess that’s just a different way of linking to the same thing.
7 - yep, had those flags set.

So, got rid of the previous error, now just getting Rez error 3, but still working on it (just about to look at point 4…).

Thanks,
Madwort

failed to find AudioUnit/AudioUnit.r/Users/tom/Documents/projects/owl-pedal/OwlSim/Builds/MacOSX/../../modules/juce_audio_plugin_client/AU/juce_AU_Resources.r:27: ### /Applications/Xcode.app/Contents/Developer/usr/bin/Rez - SysError 2 during open of "AudioUnit/AudioUnit.r".Fatal Error!
/Users/tom/Documents/projects/owl-pedal/OwlSim/Builds/MacOSX/../../modules/juce_audio_plugin_client/AU/juce_AU_Resources.r:27: ### /Applications/Xcode.app/Contents/Developer/usr/bin/Rez - Fatal Error, can't recover.
/Users/tom/Documents/projects/owl-pedal/OwlSim/Builds/MacOSX/../../modules/juce_audio_plugin_client/AU/juce_AU_Resources.r: ### /Applications/Xcode.app/Contents/Developer/usr/bin/Rez - Since errors occurred, /Users/tom/Library/Developer/Xcode/DerivedData/OwlSim-cpkooekallczofdinjczuavgckmp/Build/Intermediates/OwlSim.build/Debug/OwlSim.build/ResourceManagerResources/Objects/juce_AU_Resources.rsrc's resource fork was not written.
Command /Applications/Xcode.app/Contents/Developer/usr/bin/Rez failed with exit code 3

Madwort,

I’ve been hacking around to get this working and can’t offer you a definitive explanation of why, but if you create this folder with the necessary CA files in and move it to the Juce Library Code folder it should help (I’ve copied this setup from the juce demo plugin project downloaded with juce - you can look in this to see which CA files you need).

Hope this helps, you’re nearly there.

Tom.

Hi, I’m having the same problems as madwort and think its step 4 that i need to complete but I’m not sure what files to include , and I haven’t been able to find the juce demo plugin. Any chance you could list the files I need to add to this folder?

Thanks.

Hi,

The juce demo plugin is included with the juce download (it’s not part of OWLSim). Here is a list of the Core Audio files you need:

CAAudioChannelLayout.cpp
CAAudioChannelLayout.h
CAAUParameter.cpp
CAAUParameter.h
CADebugMacros.h
CAMutex.cpp
CAMutex.h
CAStreamBasicDescription.cpp
CAStreamBasicDescription.h
CAVectorUnit.cpp
CAVectorUnit.h
CAVectorUnitTypes.h

AUViewLocalizedStringKeys.h

AUEffectBase.cpp
AUEffectBase.h
AUMIDIBase.cpp
AUMIDIBase.h
AUMIDIEffectBase.cpp
AUMIDIEffectBase.h
AUOutputBase.cpp
AUOutputBase.h
MusicDeviceBase.cpp
MusicDeviceBase.h

AUBase.cpp
AUBase.h
AUDispatch.cpp
AUDispatch.h
AUInputElement.cpp
AUInputElement.h
AUOutputElement.cpp
AUOutputElement.h
AUResources.r
AUScopeElement.cpp
AUScopeElement.h
ComponentBase.cpp
ComponentBase.h

Ok, added a group with that list of files (double-checked against the juce AU demo project). Now get a new bunch of errors that look like this:

Check dependencies

warning: The specified SDK “Current OS X” does not appear to have all of the necessary headers installed.  Update your project to use a built-in SDK (“Latest OS X” is recommended) or install the system headers (included with the “Command Line Tools” package) from the “Downloads” pane in the Xcode preferences.

In file included from /Library/Developer/CoreAudio/AudioUnits/AUPublic/AUBase/AUOutputElement.cpp:47:
In file included from /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUOutputElement.h:50:
/Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUScopeElement.h:50:10: fatal error: 'map' file not found
#include <map>

In file included from /Library/Developer/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:47:
/Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.h:50:10: fatal error: 'TargetConditionals.h' file not found
#include <TargetConditionals.h>

In file included from /Library/Developer/CoreAudio/AudioUnits/AUPublic/AUBase/ComponentBase.cpp:47:
/Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/ComponentBase.h:50:10: fatal error: 'new' file not found
#include <new>

In file included from /Library/Developer/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp:47:
/Library/Developer/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.h:50:10: fatal error: 'vector' file not found
#include <vector>

(for reference, I’m on OS X 10.8.4 and XCode 4.6.2).
Changing various project settings in favour of ‘this version of os x’ seems to have got that down to just one “#include <new>” error, but still not quite there…

  • Madwort

It seems like you are missing some standard header files like vector and map.

Did you do these:

Update your project to use a built-in SDK (“Latest OS X” is recommended) or install the system headers (included with the “Command Line Tools” package) from the “Downloads” pane in the Xcode preferences.

I played around with the SDK settings, just waiting for the Command Line Tools package to download…

Ok, Command Line Tools package installed, now I get “Rez failed with exit code 2”. In your post you said “in Build phases only have the juce AUResources.r file – delete the other one!” - which one did you mean? I now have “Juce Library Code/Juce AU Wrapper/AUResources.r” and “Juce Library Code/juce_AUResources.r”.

Delete “Juce Library Code/Juce AU Wrapper/AUResources.r”, leaving “Juce Library Code/juce_AUResources.r” in place

Ok, deleted “Juce Library Code/Juce AU Wrapper/AUResources.r”, now I get the 82 linker errors that I got originally! Bah!

Can you post the error message?

Here it is:
http://hoxtonowl.com/forums/topic/trouble-compiling-audiounit/#post-482

OK - I would recommend to try building the project from the introjucer file (OWLSim.jucer) - you’ll have to add the CA files here again, but it does makes life easier.

I added the files you listed and some other ones xcode said were missing. Im now getting the error AUPlugInDispatch.cpp not found, even though it is in the AU wrapper folder. Any ideas on how to fix this? Thanks

You shouldn’t need any more of the CA files other than the ones listed. Try downloading Juce and copying the setup in the Juce Demo Plugin example project.

I have now created the project from the .jucer and added the files from the demo plugin. I get an error saying ‘CAXException.h’ not found, from the ComponentBase.h file. any ideas of what the issue is?

Ok - simplified now. Scrap the old OWLSim project and clone latest version from github, then:

open introjucer file

In Config, enable Build AudioUnit

Under XCode(MacOSX) add extra frameworks - AudioUnit, CoreAudio, CoreAudioKit

Save project and open in Xcode

The files in the juce AU wrapper folder appear red. Do I need to re add them or have I done a previous step incorrectly. Thanks for the swift replies :slight_smile:

If they are appearing red, re-add them in the introjucer