Mac Catalyst + Audio Unit v3 plug-in not working as expected.

I'm having trouble getting my iPad app / AUv3 synth working on macOS via Mac Catalyst. The app works fine in standalone mode but the DAWs aren't able to load. Error both from GarageBand and Logic Pro are too cryptic to decipher what's going wrong. This is on Big Sur.

This is from Logic Pro auval:

validating Audio Unit Mela 2 by Nikolozi:



    AU Validation Tool

    Version: 1.8.0 

    Copyright 2003-2019, Apple Inc. All Rights Reserved.

    Specify -h (-help) for command options



--------------------------------------------------

VALIDATING AUDIO UNIT: 'aumu' - 'Mel2' - 'NKLZ'

--------------------------------------------------

Manufacturer String: Nikolozi

AudioUnit Name: Mela 2

Component Version: 1.6.0 (0x10600)



* * PASS

--------------------------------------------------

TESTING OPEN TIMES:

COLD:

FATAL ERROR: OpenAComponent: result: 4,0x4





validation result: couldn’t be opened

From GarageBand logs I have this (this happens when I try to load the synth as an instrument plug-in):



2021-06-13 10:23:12.078357+0400 GarageBand[99801:5732544] [lifecycle] [u 589AF1E2-2BE5-451F-A613-EC9BA71325E9:m (null)] 

[com.nikolozi.Mela.InstrumentExtension(1.0)] Failed to start plugin; pkd returned an error: Error Domain=PlugInKit Code=4 "RBSLaunchRequest error trying to launch plugin com.nikolozi.Mela.InstrumentExtension(589AF1E2-2BE5-451F-A613-EC9BA71325E9): Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x7faa9232ca40 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed with error: 153}}}" UserInfo={NSLocalizedDescription=RBSLaunchRequest error trying to launch plugin com.nikolozi.Mela.InstrumentExtension(589AF1E2-2BE5-451F-A613-EC9BA71325E9): Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x7faa9232ca40 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed with error: 153}}}}



2021-06-13 10:23:12.078518+0400 GarageBand[99801:5732544] [plugin] Unable to acquire process assertion in beginUsing: with plugin identifier: com.nikolozi.Mela.InstrumentExtension, killing plugin



2021-06-13 10:23:12.078814+0400 GarageBand[99801:5732544] [plugin] PlugInKit error in beginUsing: with plugin identifier: com.nikolozi.Mela.InstrumentExtension, killing plugin



2021-06-13 10:23:12.153420+0400 GarageBand[99801:5730475] Failed to instantiate AU.

Description: RBSLaunchRequest error trying to launch plugin com.nikolozi.Mela.InstrumentExtension(589AF1E2-2BE5-451F-A613-EC9BA71325E9): Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x7faa9232ca40 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed with error: 153}}}

Reason: (null)

I've tried Apple's sample code AUv3Filter. And turned on Mac Catalyst for the AUv3Filter iOS target. And it runs fine in Logic Pro.

I'm not sure what's incompatible in my code that fails to work as AUv3 in Mac catalyst. Any known issues for Mac Catalyst+AUv3 combo that I should be aware of / investigate?

Answered by NikoloziApps in 678942022

Looks like the app extension needs to have this entry in its entitlements file:

	<key>com.apple.security.app-sandbox</key>
	<true/>

The AUv3 now loads and works in Reaper, but it looks like I have other auval issues to deal with before it will load in Logic Pro.

Accepted Answer

Looks like the app extension needs to have this entry in its entitlements file:

	<key>com.apple.security.app-sandbox</key>
	<true/>

The AUv3 now loads and works in Reaper, but it looks like I have other auval issues to deal with before it will load in Logic Pro.

To benefit others and my future self, I thought I'd list some of the others issues I had to deal with when trying to bring AUv3 to Mac using Catalyst. Most of the issues I had to address was due to auval not liking something and hence Logic Pro using that as a reason not to list my plug-ins. Here we go:

  • It's better to explicitly report supported channel configurations. If you support things like side chain etc. Just override - (NSArray<NSNumber *> *)channelCapabilities in your AU subclass.
  • fullState requires you to report to provide values for "type", "subtype" and "manufacturer" in the dictionary. I have a custom implementation of fullState and wasn't setting these values.
  • Last thing that drove me nuts was that, during auval runs, my AU extension would crash but the auval would report as this:
Checking parameter setting
Using AudioUnitSetParameter
Using AudioUnitScheduleParameter
ERROR: -66745 IN CALL AudioUnitRender

Turns out auval seems to be sending parameter address that's garbage value Not sure if it's intentional or not. But it does it 8 times.

Initially, I thought there was a bug in my code. But the same thing happens in the Apple's sample code I mentioned in the original post. You can reproduce this yourself, just paste this code inside the internalRenderBlock method and watch the debugs in Mac's Console app:

#import <os/log.h>
///...
auto event = realtimeEventListHead;
while (event != NULL) {
    if (event->head.eventType == AURenderEventParameter || event->head.eventType == AURenderEventParameterRamp) {
        os_log_error(OS_LOG_DEFAULT, "AUv3DEMO ParameterAddress: %llu", event->parameter.parameterAddress);
    }
    event = event->head.next;
}

I used this command: auval -v aufx fltr Demo

In addition to printing out 3 valid parameter addresses, it prints out 2798869411, 10 times. I've now added a check to my code to ensure param address is a valid value.

I've also mentioned this issue on Apple's mailing list: https://lists.apple.com/archives/coreaudio-api/2021/Jun/msg00017.html

If you are trying to do any file access from the audio unit extension, e.g preset import/export, be sure to add the following entry to the extension's entitlements file:

<key>com.apple.security.files.user-selected.read-write</key>
	<true/>

Otherwise, you will get exotic crashes when trying to display file access panels (e.g. SwiftUI's .fileImporter()).

Mac Catalyst + Audio Unit v3 plug-in not working as expected.
 
 
Q