Juce AU Wrapper <-> CoreAudio: Broken on Lion 10.7.3 [fixed]

Hi people:

I can’t find a thread that expresses this point explicitly, so I’m posting the point here.

I’ve already read these threads, that - while useful - have not got me a workaround as yet:
http://www.rawmaterialsoftware.com/viewtopic.php?f=8&t=7563
http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=7862

I have two main dev macs, my 10.6 MacPro at home and my 10.7 MacPro in the office. When I’m at home (10.6) - irrespective of whether I’m using XCode 3 or 4.1 preview - I can make a few adjustments to the project file created by the Introducer and I’m on my way. *Tick!

However, the same project (either fresh or imported) creates a slew of new errors when I bring it to the office (10.7).

Aside from AUDebugDispatcher being notably absent from the current CoreAudio SDK (easily removing from the list of file refs), LLVM will flag errors routed in these headers:

ComponentBase.h
Unknown type: AudioComponentPlugInInterface

AUPlugInDispatch.h
Unknown type: AudioComponentMethod

AUBase.h
Undeclared: kAudio_UnimplementedError

All of which are referenced by the Juce AU wrapper “group”, either from /Developer/Extras/CoreAudio or XCode.app/Contents/Developer/Extras/CoreAudio (as of v4.3, assuming you’ve followed Jule’s instructions).

The errors themselves are mundane, but prevent Juce plug-in framework from working in the way that it was intended, i.e. out of the box.

I should also mention that the Base SDK is correctly, i.e. 10.6, and the header include paths are:
/Developer/SDKs/vstsdk2.4
(DEVELOPER_DIR)/Extras/CoreAudio/PublicUtility (DEVELOPER_DIR)/Extras/CoreAudio/AudioUnits/AUPublic/Utility
$(inherited)

If I set this flag:

#define JucePlugin_Build_AU 0

…and remove the Apple AU Files group from the project, I can build the VST2.4 part no problem at all.

I know Jules is probably busy with other matters, but I do think this is a big enough problem to need at least an all-in-one-place howto doc to get Juce AU Wrapper reconciled with CoreAudio. The Introducer can be fixed later. If this turns out to be Apple’s screw-up then this needs to be established with due dilligence and the appropriate people nagged. I have some contact info for that.

Discuss…

All the best,
-Rob.

I forgot to add:

This issue is exhibited with the “AudioTools for XCode” version of the CoreAudio SDK dated Feb 16 2012.

Since the AudioUnit project type is suspiciously missing from the new project wizard, I tried to build one of their own sample projects.

I followed this advice, but didn’t get much further:
https://developer.apple.com/library/mac/#technotes/tn2276/_index.html#//apple_ref/doc/uid/DTS40011031

Hi Rob.

That’s odd, the juce demo plugin compiles for me without any problems, even in Xcode 4.3 and the 10.7 SDK. Really not sure what I can suggest!

Hi Jules,

Can you zip-up that Juce demo plug-in XCode project you have working and post it here? I’d like to check out a few things.

I remember a while ago that a standard OS update blew away some headers that needed to live in /System/Library/Frameworks and threw a real spanner in the works for me. It might be something like that. Maybe.

If I can repro the build errors with your project it at least gives me a clue as to where to look.

-Rob.

It’s just the one in the repository - I don’t have a secret “fixed” one!

Looking back at this problem a few minutes ago, I can get it all to build IF

  1. I’ve matched the Feb 2012 CoreAudio SDK with the 10.7 Base SDK in my project settings (no surprises there).

  2. My header include search paths are “/Developer/SDKs/vstsdk2.4 (DEVELOPER_DIR)/Extras/CoreAudio/PublicUtility (DEVELOPER_DIR)/Extras/CoreAudio/AudioUnits/AUPublic/Utility $(inherited)” - which translates to within the XCode.app bundle (this is where my CoreAudio SDK is now residing). You already know about this or course.

  3. In “AUMIDIEffectBase.cpp” I comment out the line “(TEMP_MusicDeviceMIDIEventProc *)outData = AUMIDIEffectBaseMIDIEvent;”

I.e.

OSStatus AUMIDIEffectBase::GetProperty( AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
void * outData)
{
OSStatus result;

#if !CA_USE_AUDIO_PLUGIN_ONLY
if (inID == kAudioUnitProperty_FastDispatch) {
if (inElement == kMusicDeviceMIDIEventSelect) {
//(TEMP_MusicDeviceMIDIEventProc )outData = AUMIDIEffectBaseMIDIEvent; / Not good */
return noErr;
}
return kAudioUnitErr_InvalidElement;
}
#endif

What surprises me is how you could ever this code to build without that preprocessor.

Surely “(TEMP_MusicDeviceMIDIEventProc *)outData = AUMIDIEffectBaseMIDIEvent;” is not even legal syntax?!

…Very confused…

All better now:

#if !CA_USE_AUDIO_PLUGIN_ONLY
if (inID == kAudioUnitProperty_FastDispatch) {
if (inElement == kMusicDeviceMIDIEventSelect) {
outData = (void *)AUMIDIEffectBaseMIDIEvent;
return noErr;
}
return kAudioUnitErr_InvalidElement;
}
#endif

…STILL very confused though…

You have to go to developer.apple.com, log-in and search for the Audio Tools for Xcode - Februrary 2012!

See also here - what a mess!

http://www.subfurther.com/blog/2012/02/26/the-audio-tools-for-xcode-4-3-switcharoo/

Actually - that download doesn’t include everything you need (!), I had to use old files I had under /Developer on my Mac, and edit my project include path to be something like this:

…mystuff… /Developer/Extras/CoreAudio/AudioUnits/AUPublic/Utility /Developer/Extras/CoreAudio/AudioUnits/AUPublic/OtherBases /Developer/Extras/CoreAudio/PublicUtility /Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase

I then had to remove the old (missing) CoreAudio .cpp files from my project, and drag-in the old versions into my project.

What a nightmare. :slight_smile:

Jules, have you got any ideas on this?! :frowning:

HTH!

Pete

Based on peteatjuce’s link, developers may choose different locales for the Extras/CoreAudio files. Would it be helpful to allow this locale to be edited in the Introjucer?

Just going back to this today while setting up the wife’s Macbook for “adhoc development”, I noticed that the latest “Audio Tools for XCode” download from Late July 2012 is completely devoid of the CoreAudio SDK folder. :evil:

So… I had to re-download the broken “Audio Tools for XCode” download from February 2012 and repatch all those source files again. :roll:

Oh, and if you’re expecting to build against VST 2.4 SDK rev2 you’ll have to tweak a line in…

void AudioEffect::int2string (VstInt32 value, char* text, VstInt32 maxLen)

…because the current gcc won’t allow casting in initializing lists. :roll:

I.e.

//FROM

char temp[2] = {‘0’ + (char)digit, ‘\0’};

//TO

char tmp = ‘0’ + (char)digit;
char temp[2] = {tmp, ‘\0’};

:?

And they still haven’t reimbursed my travel expenses from last May. But that’s a whole other story.

cool thanks for the solution. but i find it much nicer like this:

char temp[2] = {static_cast<char>('0' + (char)digit), '\0'};