Attention! For Japanese customers, my Japanese blog might help.

Oct 16, 2017

Steps to make your homemade V3 AudioUnit support in-process loading

NOTE: This is the English version of my Japanese article.

To make my homemade AudioUnit available in GarageBand in the last article,
It seems necessary to support in-process loading.

As a result of trial and error, I was able to release GarageBand compatible version.
After all, I imitated AudioUnitV3Example's implementation.
Here is a rough modification procedure.

Steps:
1: Make the new cocoa framework target for AU.
2: Move all implementation files of AU (.appex) target to the framework target. However, .xib and image resources need to be included in both targets.
3: Prepare a .m file and implement a dummy function. Include it in the .appex target.
4: Edit Info.plist of .appex. Add a key named "AudioComponentBundle" to NSExtension -> NSExtensionAttributes and set the bundle identifier of the framework target as a value.
5: Override the init of the AU view controller with reference to the sample code FilterDemoViewController.m. In my case, it is as follows:
- (id)init {
    self = [super initWithNibName:@"AudioUnitViewController"
                           bundle:[NSBundle bundleForClass:NSClassFromString(@"AudioUnitViewController")]];
    return self;
}
Without this we could not display the view with GarageBand.
I think that handling AU of GarageBand may be different from that of sample code.

Other tips:
If you use external frameworks, which were already used before supporting in-process loading,
it seems better to embed them in both the .app and the .framework.
If the external frameworks are not embeded in .appex, GarageBand may not be able to load your AU with an error like the following:
Error loading {...snipped...}/SYVibratoFramework:  dlopen({...
snipped...}/SYVibratoApp.app/Contents/Frameworks/SYVibratoFramework.framework/SYVibratoFramework, 265): Library not loaded: @rpath/SYFW.framework/Versions/A/SYFW
  Referenced from: {...
snipped...}/SYVibratoApp.app/Contents/Frameworks/SYVibratoFramework.framework/SYVibratoFramework
  Reason: image not found
Perhaps you can solve it without embedding if you can set @rpath.


--
I'm looking for job for macOS/iOS application development by outsourcing.
For details, please visit my web site.

No comments:

Post a Comment