Audio Unit v3 UI

I've written an audio unit which I've been testing by loading it in the application from the sample code (https://developer.apple.com/library/content/samplecode/AudioUnitV3Example/Introduction/Intro.html).


The good part

All audio processing works as expected.


The problem

The audio unit extention's view doesn't show. The extension is registered as having a UI, by the NSExtensionPointIdentifier property being set to

com.apple.AudioUnit-UI, and the sample code host will open the custom view pane, but the UI is simply blank.


The frustration

As said, the audio is being processed, but the UI doesn't appear. And to make matters worse; there is no errors reported, so it's difficult to troubleshoot.


The question

Why? — What is wrong, since the audio unit won't show its UI?


There seems to be some discrepancies in the documentation as to why this could be happening.


One place states that it's all about the plist, opting in or out for UI:

"The name of the main storyboard file for the Audio Unit app extension. This key is required unless you are specifically creating an Audio Unit app extension without a user interface. In that unusual case, use the

NSExtensionPrincipalClass
key instead."

However, the sample code, does not follow this documentation, as it uses NSExtensionPrincipalClass in its plist.


I've tried both ways though, none of them work. I've even tried to strip the filter demo code down to what I have in mine, gradually taking away pieces to see when it fails to produce the UI — no luck finding the "magic" that makes the UI appear.


I expect I'm missing something. Hard to tell what though, when there is no error reported.

Accepted Reply

I've managed to fix the problem, simply by using an Objective-C version of the view controller. I have no idea why the Swift version didn't work.

Replies

I've managed to fix the problem, simply by using an Objective-C version of the view controller. I have no idea why the Swift version didn't work.

did you compile the ios demo?


did you try reading the AV header files? i suspect you're missing a bridge.


i found if you get public CoreAudio files and read the headers, you can figure stuff out. it has code in c++ which i understand instead of obj-c.


you didn't by any chance happen to write a plugin for flac???

Is it your final solution? Go back to Objecive-C?


I've always wondered why the controllers were written in different languages in the official sample code. The iOS version in Swift and the OSX in Obejective-C.

I've finally made the test and tried to upgrade the controller of the OSX project to Swift in a fresh new project. By the way I also used a storyboard instead of the xib file.

No so much issues, and the host app ran like a charm, but... When I tried an auva on my plugin I get a FATAL ERROR: OpenAComponent: result: -10863.

Which means that something is eating... and the process has been aborted. I never had this issue with the Objective-C version. My guess it that the controller defined in the storyboard is not visble or so...

I've performed a couple of new experimentations and confirm:


Using a Swift version of the controller is working nice and the UI is shown properly in Logic Pro X


No need to switch back to Objective-C 😮


My first test didn't succeed because:

  • I wanted to use a storyboard, XIB seems the only way to go!
  • I forgot to use @objc(ViewController) in the Framework


Finally, don't forget the App. You have to deal with Nib loading instead of story board.


Hope this helps!