diff --git a/AudioUnit/AmuseContainer.entitlements.in b/AudioUnit/AmuseContainer.entitlements.in
new file mode 100644
index 0000000..44210a9
--- /dev/null
+++ b/AudioUnit/AmuseContainer.entitlements.in
@@ -0,0 +1,14 @@
+
+
+
+
+ com.apple.application-identifier
+ @APPLE_TEAM_ID@.@APPLE_BUNDLE_ID@
+ com.apple.developer.team-identifier
+ @APPLE_TEAM_ID@
+ com.apple.security.application-groups
+
+ group.io.github.axiodl.Amuse.AudioGroups
+
+
+
diff --git a/AudioUnit/AmuseContainerMainMenu.xib b/AudioUnit/AmuseContainerMainMenu.xib
new file mode 100644
index 0000000..66246a9
--- /dev/null
+++ b/AudioUnit/AmuseContainerMainMenu.xib
@@ -0,0 +1,530 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AudioUnit/AmuseContainingApp.mm b/AudioUnit/AmuseContainingApp.mm
index a459a24..7b8524e 100644
--- a/AudioUnit/AmuseContainingApp.mm
+++ b/AudioUnit/AmuseContainingApp.mm
@@ -3,19 +3,44 @@
#import
#import "AudioUnitViewController.hpp"
-@interface AppDelegate : NSObject
-{}
+@interface MainView : NSView
+{
+ AudioUnitViewController* amuseVC;
+}
+@end
+
+@implementation MainView
+
+
+- (id)initWithFrame:(NSRect)frameRect
+{
+ self = [super initWithFrame:frameRect];
+ if (!self)
+ return nil;
+ amuseVC = [[AudioUnitViewController alloc] initWithNibName:nil bundle:nil];
+ [self addSubview:amuseVC.view];
+ return self;
+}
+
+- (BOOL)translatesAutoresizingMaskIntoConstraints
+{
+ return NO;
+}
+
@end
@interface ViewController : NSViewController
{
+ NSWindow* _window;
NSButton* playButton;
- AudioUnitViewController* amuseVC;
}
+@end
-@property (weak) IBOutlet NSView *containerView;
--(IBAction)togglePlay:(id)sender;
-
+@interface AppDelegate : NSObject
+{
+ NSWindow* mainWindow;
+ ViewController* containerVC;
+}
@end
@implementation ViewController
@@ -25,9 +50,9 @@
#if 0
AudioComponentDescription desc;
/* Supply the correct AudioComponentDescription based on your AudioUnit type, manufacturer and creator.
-
+
You need to supply matching settings in the AUAppExtension info.plist under:
-
+
NSExtension
NSExtensionAttributes
AudioComponents
@@ -35,7 +60,7 @@
type
subtype
manufacturer
-
+
If you do not do this step, your AudioUnit will not work!!!
*/
desc.componentType = kAudioUnitType_MusicDevice;
@@ -43,9 +68,9 @@
desc.componentManufacturer = 'Demo';
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
-
+
[AUAudioUnit registerSubclass: AUv3InstrumentDemo.class asComponentDescription:desc name:@"Local InstrumentDemo" version: UINT32_MAX];
-
+
playEngine = [[SimplePlayEngine alloc] initWithComponentType: desc.componentType componentsFoundCallback: nil];
[playEngine selectAudioUnitWithComponentDescription2:desc completionHandler:^{
[self connectParametersToControls];
@@ -54,32 +79,67 @@
}
-(void)loadView {
- amuseVC = [[AudioUnitViewController alloc] initWithNibName:nil bundle:nil];
- self.view = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 200, 300)];
- [self.view addSubview:amuseVC.view];
-
- self.view.translatesAutoresizingMaskIntoConstraints = NO;
-
- NSArray *constraints = [NSLayoutConstraint constraintsWithVisualFormat: @"H:|-[view]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(self.view)];
- [self.view addConstraints: constraints];
-
- constraints = [NSLayoutConstraint constraintsWithVisualFormat: @"V:|-[view]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(self.view)];
- [self.view addConstraints: constraints];
+ self.view = [[MainView alloc] initWithFrame:[_window contentRectForFrameRect:_window.frame]];
+}
+
+- (id)initWithWindow:(NSWindow*)window
+{
+ self = [super initWithNibName:@"AmuseContainerMainMenu" bundle:nil];
+ if (!self)
+ return nil;
+ _window = window;
+ return self;
}
@end
@implementation AppDelegate
+- (void)applicationDidFinishLaunching:(NSNotification*)notification
+{
+ [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints"];
+
+ /* App menu */
+#if 0
+ [NSMenu alloc] ini
+ NSMenu* rootMenu = [[NSMenu alloc] initWithTitle:@"main"];
+ NSMenu* appMenu = [[NSMenu alloc] initWithTitle:@"Amuse"];
+ NSMenuItem* quitItem = [appMenu addItemWithTitle:@"Quit Amuse"
+ action:@selector(quitApp:)
+ keyEquivalent:@"q"];
+ [quitItem setKeyEquivalentModifierMask:NSCommandKeyMask];
+ [[rootMenu addItemWithTitle:@"Amuse"
+ action:nil keyEquivalent:@""] setSubmenu:appMenu];
+ [[NSApplication sharedApplication] setMainMenu:rootMenu];
+
+ NSRect mainScreenRect = [[NSScreen mainScreen] frame];
+ mainWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(mainScreenRect.size.width / 2 - 100,
+ mainScreenRect.size.height / 2 - 150, 200, 300)
+ styleMask:NSClosableWindowMask|NSTitledWindowMask
+ backing:NSBackingStoreBuffered
+ defer:YES];
+ [mainWindow setTitle:@"Amuse"];
+ [[mainWindow windowController] setShouldCascadeWindows:NO];
+ [mainWindow setFrameAutosaveName:@"AmuseDataWindow"];
+ containerVC = [[ViewController alloc] initWithWindow:mainWindow];
+ [mainWindow setContentViewController:containerVC];
+ [mainWindow makeKeyAndOrderFront:nil];
+#endif
+}
+
+- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
+{
+ return YES;
+}
+
+- (IBAction)quitApp:(id)sender
+{
+ [NSApp terminate:sender];
+}
+
@end
-int main(int argc, const char * argv[]) {
- NSApplication* app = [NSApplication sharedApplication];
- [app setActivationPolicy:NSApplicationActivationPolicyRegular];
-
- /* Delegate (OS X callbacks) */
- AppDelegate* delegate = [AppDelegate new];
- [app setDelegate:delegate];
- [app run];
- return 0;
+int main(int argc, const char * argv[])
+{
+ NSApplicationMain(argc, argv);
}
diff --git a/AudioUnit/Amuse.entitlements.in b/AudioUnit/AmuseExtension.entitlements.in
similarity index 76%
rename from AudioUnit/Amuse.entitlements.in
rename to AudioUnit/AmuseExtension.entitlements.in
index df34d36..155e803 100644
--- a/AudioUnit/Amuse.entitlements.in
+++ b/AudioUnit/AmuseExtension.entitlements.in
@@ -8,5 +8,9 @@
@APPLE_TEAM_ID@
com.apple.security.app-sandbox
+ com.apple.security.application-groups
+
+ group.io.github.axiodl.Amuse.AudioGroups
+
diff --git a/AudioUnit/AudioGroupFilePresenter.hpp b/AudioUnit/AudioGroupFilePresenter.hpp
new file mode 100644
index 0000000..ccfabfb
--- /dev/null
+++ b/AudioUnit/AudioGroupFilePresenter.hpp
@@ -0,0 +1,37 @@
+#ifndef __AMUSE_AUDIOUNIT_AUDIOGROUPFILEPRESENTER_HPP__
+#define __AMUSE_AUDIOUNIT_AUDIOGROUPFILEPRESENTER_HPP__
+
+#import
+#include