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

Oct 16, 2017

Could not create the view of homemade V3 AudioUnit

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

As mentioned in this article, although I could make an AVAudioUnit instance,  the view controller for the AU  was not created this time.

I have used -[AUAudioUnit requestViewControllerWithCompletionHandler:] to create the view controller, but "viewController" in completionHandler was always nil.

By referring to the implementation of -[ViewController embedPlugInView] in an Apple's sample code "AudioUnitV3Example", I fixed my code to make a view directly from a bundle.
Finally, I could create a view controller.

My implementation of embedPlugInView is as follows:

- (void)embedPlugInView {
    NSURL *builtInPlugInURL = [[NSBundle mainBundlebuiltInPlugInsURL];
    NSURL *pluginURL = [builtInPlugInURL URLByAppendingPathComponent@"SYVibrato.appex"];
    NSBundle *appExtensionBundle = [NSBundle bundleWithURL: pluginURL];
  
    self.vibratoViewController = [[AudioUnitViewController allocinitWithNibName:@"AudioUnitViewController"                                                                           bundle:appExtensionBundle];
  
    [self.vibratoProgressIndicator stopAnimation:self];    NSRect r = self.vibratoView.frame;
    [self.vibratoViewController view].frame = NSMakeRect(00NSWidth(r), NSHeight(r));    [self.vibratoView addSubview:self.vibratoViewController.view];  
    [self.vibratoViewController connectAU:self.vibratoUnit.AUAudioUnit];}

Note that, if your AU can be recognized with a third party host apps, you can create a view with the conventional method requestViewControllerWithCompletionHandler: as well.

Because AU cannot be recognized(installed) immediately on macOS 10.13, it may be that such a correction has become necessary.

To avoid wasting time, we had better use projects in "AudioUnitV3Example" as a template.

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

No comments:

Post a Comment