Posts

Post not yet marked as solved
3 Replies
668 Views
I'm developing a v3 Audio Unit Extension and I'd like it to be able to work on both mono and stereo files with a range of sample rates. All of the examples that I've come across have the sample rate and number of channels hard-coded within a standard init method of one of the audio unit's classes. It doesn't seem like there is a way to pass this information from a host to the audio unit when it is being set up. Ideally, I'd like to have access to it within the audio unit's initWithComponentDescription method, as that's where I set up the kernel. I managed to get it working in my host app, but did so by calling setters on the audio unit that other hosts don't know about. I'd like my extensions to load and function in other hosts as well. How are sample rate and number of channels supposed to be handled?
Posted
by mfren.
Last updated
.
Post not yet marked as solved
2 Replies
645 Views
I'm trying to develop v3 Audio Unit Extensions for MacOS. I'll have several of these and so I'd like to create a reusable window/panel architecture that contains buttons like Process, Cancel, Bypass... these buttons should be the same for any audio unit chosen. I want to load the audio unit UI within a container view in that window/panel template. Something like the following: Window/Panel Template ............................................... | | | ................................ | | | | | | | container view | | | | AU UI goes here | | | | | | | ............................... | | | | Button 1. Button 2 | ............................................... I'm instantiating the audio unit successfully and calling requestViewControllerWithCompletionHandler to get the Audio Unit UI. Then I'm adding the returned auViewController as a childViewController to the window's view controller and adding the auViewController.view as a subview of the containerView. This doesn't work and I can't figure out why. The returned auViewController is of type AURemoteAudioUnitViewController... not my audio unit's view controller class. Note sure if that has anything to do with it, but I don't seem to be touching my class at all. The code is below. Note that, if I set the window controller's contentViewController to the auViewController returned by requestViewControllerWithCompletionHandler (i.e. auwindowController.contentViewController = auViewController) it does work. I can see the audio unit's UI and control the sound using params in real-time. All seems to be fine except that I can't seem to figure out how to embed the audio unit UI into a view container of another window. Am I going about this the wrong way? Any help would be greatly appreciated! // CODE     [AVAudioUnit instantiateWithComponentDescription: description options: kAudioComponentInstantiationLoadOutOfProcess completionHandler:^(AVAudioUnit* audioUnit, NSError *error)     {         if(error == noErr)         {             if(YES == [[audioUnit AUAudioUnit] providesUserInterface])             {                 [[audioUnit AUAudioUnit] requestViewControllerWithCompletionHandler: ^(AUViewControllerBase *auViewController)                 {                     NSStoryboard *austoryboard = [NSStoryboard storyboardWithName:@"AUPluginWindow" bundle:nil];                     AUWindowController *auwindowController = [austoryboard instantiateControllerWithIdentifier:@"AUWindowController"];                     AUPanelViewController *aupanelViewController = (AUPanelViewController*)auwindowController.contentViewController;                     NSWindow *auWindow = [auwindowController window];                     [auWindow setFrame: NSMakeRect(100, 100, 600, 300) display: YES];                     [auWindow makeKeyAndOrderFront: self];                     // get containerView - IBOutlet in AUPanelViewController                     NSView *containerView = [aupanelViewController getContainerView];                     // Add the AudioUnitViewController as child to the window's view controller                     [aupanelViewController addChildViewController: auViewController];                     [[auViewController view] setFrame: containerView.bounds ];                     // add audio unit view as subview to containerView                     [containerView addSubview: auViewController.view];                 }];             }         }         else             NSLog(@"Error instantiating audio unit");     }];
Posted
by mfren.
Last updated
.