I have been trying to test the latest MacOS AudioWorkgroup support in JUCE 7.0.7 develop. Debug builds are fine, stand-alone app and non-AU plug-in builds are fine. Release AU builds are fine when I run Logic Pro X under Rosetta. Attempting to load a Release AU in Logic Pro X running natively yields the useless/condescending/smarmy error pop-up “An Audio Unit plug-in reported a problem which might cause the system to become unstable. Please quit and restart Logic Pro.” Within the Console app I’m able to see numerous AUHostingServiceXPC_arrow crash reports, all of which indicate a EXC_BAD_ACCESS (SIGSEGV) exception with KERN_INVALID_ADDRESS at 0x0000000000000000. The crash occurs in the main thread (Thread 0), and the stack trace always looks something like this:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_blocks.dylib 0x182906bb4 _Block_copy + 180
1 AudioToolboxCore 0x1848e350c RenderContextChangeGenerator& std::__1::optional::emplace[abi:v15006]<void (AudioUnitRenderContext const*) block_pointer __strong&, void>(void (AudioUnitRenderContext const*) block_pointer __strong&) + 60
2 AudioToolboxCore 0x1848e34a4 APComponentInstance::postOpen() + 120
3 AudioToolboxCore 0x1848e3068 APComponent::newInstance(unsigned int, bool, void (OpaqueAudioComponentInstance*, int) block_pointer) + 2576
4 AudioToolboxCore 0x1849bdd48 -[AUAudioUnitV2Bridge initWithComponentDescription:options:error:] + 740
5 AudioToolboxCore 0x18495a83c +[AUAudioUnit instantiateWithComponentDescription:options:connectionProvider:completionHandler:] + 1612
…
When I say the stack trace always looks “something like” the above, what I mean is that execution always gets into APComponentInstance::postOpen(), but what’s above that seems to vary a bit, as though what happens depends on the contents of some data structure which is uninitialized.
After wasting hours trying changes to my own plug-in code, I decided to create a new “do-nothing” instrument (aumu) AU plug-in using the Projucer (which I also compiled using the latest JUCE 7.0.7 develop code), and it had exactly the same issue.
The only way I was able to stop this from happening was to comment out lines 589-593 of juce_audio_plugin_client_AU_1.mm like this:
#if JUCE_AUDIOWORKGROUP_TYPES_AVAILABLE case kAudioUnitProperty_RenderContextObserver: { if (auto* ptr = (AURenderContextObserver*) outData) {
// ptr = ^(const AudioUnitRenderContext context)
// {
// if (juceFilter)
// juceFilter->audioWorkgroupContextChanged (makeRealAudioWorkgroup (context != nullptr ? context->workgroup : nullptr));
// };return noErr; } } #endif
I realize this completely lobotomizes the new AudioWorkgroup handling code. I tried making finer-grain changes, e.g. inside makeRealAudioWorkgroup(), but it’s all above my pay-grade.
I’m using the latest Logic Pro X v10.7.9, the latest Xcode 14.3.1, on an M1 Mac Mini running the latest MacOS Ventura v13.5.2. I have made a local fork of JUCE 7.0.7, selected the develop branch, and made certain it is up-to-date by pulling in the most recent changes from upstream/develop.