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 mainBundle] builtInPlugInsURL];
NSURL *pluginURL = [builtInPlugInURL URLByAppendingPathComponent: @"SYVibrato.appex"];
NSBundle *appExtensionBundle = [NSBundle bundleWithURL: pluginURL];
self.vibratoViewController = [[AudioUnitViewController alloc] initWithNibName:@"AudioUnitViewController" bundle:appExtensionBundle];
[self.vibratoProgressIndicator stopAnimation:self]; NSRect r = self.vibratoView.frame;
[self.vibratoViewController view].frame = NSMakeRect(0, 0, NSWidth(r), NSHeight(r)); [self.vibratoView addSubview:self.vibratoViewController.view];
[self.vibratoViewController connectAU:self.vibratoUnit.AUAudioUnit];}
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