How to locate the directory where a AU component is in?


#1

On Windows this is very simple:

File f=File::getSpecialLocation(File::currentExecutableFile);

but on the Mac this does not return the good dir…


#2

It should work - have a look at the place where it calls juce_setCurrentExecutableFileNameFromBundleId() in the AU code. Maybe that’s not getting called because your bundle id is wrong?


#3

How can I verify if the ID is correct? The plugin works under Logic and AU Lab. It also passed the AU Validation Tool.


#4

The bundle ID is defined as JucePlugin_CFBundleIdentifier in JucePluginCharacteristics.h. But you should have the same value set in your .plist file in CFBundleIdentifier key/value pair.

HTH

Cheers,
Przemek


#5

Well, I set the CFBundleIdentifier in file Info-JuceAU.plist to the same value as in file JucePluginCharacteristics.h, but it does not work. On Windows it works. Is there anything else or some second plist file? Sorry for my dumb questions, but I am no Mac user, only compiling the stuff here on XCode.


#6

I just found out that the problem is that the component itself is a directory and the AU itself seems to be contained in /Contents/MacOS/.

The Component is located in /Users/DS/Library/Audio/Plug-Ins/Components, but the directory that is returned to me is /Users/DS/Library/Audio/Plug-Ins/Components/MYPLUGIN/Contents/MacOS

Is this normal? So one is really forced to distinguish between Windows in Mac in this code line?


#7

So when you call getSpecialLocation(File::currentApplicationFile) you will get /Users/DS/Library/Audio/Plug-Ins/Components/MYPLUGIN.component which is probably what you are looking for.

getSpecialLocation(File::currentExecutableFile) will return /Users/DS/Library/Audio/Plug-Ins/Components/MYPLUGIN/Contents/MacOS/… wich is indeed executable file nested in bundle

Is this what you want?

Cheers,
Przemek


#8

Yes, you’re absolutely right. Using currentApplicationFile makes it work on both systems. Very nice!


#9

CFBundleGetMainBundle() always returns the BundleRef of application, not a plugin. So when the plugin is used in Logic 8, the function returns the BundleRef of Logic 8.

But we don’t want to write the bundle ID in our code directly.

I found a hint in the vstgui code in the VST SDK. Get the SDK and see the source file plugineditor.cpp and search “_CFXBundleCreateFromImageName”. There is a technique to obtain the bundle’s reference without using bundle ID.

I want JUCE to do the same thing if the code is build as plug-in.

Cheers,
Masa


#10

Yes but Juce doesn’t call CFBundleGetMainBundle() to obtain the bundle’s executable file but CFBundleGetBundleWithIdentifier() which returns plugin’s bundle reference if bundle_id passed to the function was correct.

Cheers,
Przemek


#11

This seems to be the appropriate thread to attach a related question. I don’t really understand if the bundle identifier is an OSX thing or a Juce thing. My question comes because I’m building AU and VST versions of the same plugin (and potentially RTAS down the line). Do the bundle IDs need to be different between plugin types in this case?


#12

No, I don’t think it matters if they use the same ID.


#13

Thanks much Jules.


#14

One more question on the subject:
If I wiil build AU, VST and RTAS plugins, from the same sources and with the same bundle ID, will I get correct bundle references with CFBundleGetBundleWithIdentifier() call?
I mean, that is correct, that I will get a ref to RTAS plugin calling it from rtas and ref to AU plugin calling it from AU?
I am really not an expert but I’m not sure that I’m rignt with this statement.

Thanks!


#15

Well if you build a single bundle, it’ll have one bundle identifier. CFBundleGetBundleWithIdentifier() has no idea of context, it just looks at the bundle ID in the plist.


#16

So as expected, it will just return first found bundle with this ID or something like that…
thanks!