Files
sizzletracker-android/ios/app/FX/SizzleFXViewController.mm
ReactorcoremeltdownandClaude Opus 5.5 b6589ee792 iOS 0.3.0: card editors like Android's for every plugin (knobs, switches, tabs, drawings)
Layouts exported from Android's DeviceLayouts (DeviceLayouts.json), iOS layouts
for the devices with hand-built Android editors, SwiftUI editor shared by the
extension and the app, Mac snapshot tool for the editors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 22:41:33 +01:00

62 lines
2.2 KiB
Plaintext

// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
// SPDX-License-Identifier: GPL-3.0-or-later
// The extension's principal class: the factory for every device listed in
// components.txt (picked by subtype; instruments and effects), and its editor:
// the SwiftUI card editor (Editor/DeviceEditor.swift), as in the Android app.
// The app hosts the same editor for the devices it plays itself.
#import <CoreAudioKit/CoreAudioKit.h>
#import <UIKit/UIKit.h>
#import "SizzleFXViewController.h"
// The Swift side's generated header: named after the target that compiles this file.
#if __has_include("SizzleFX-Swift.h")
#import "SizzleFX-Swift.h"
#else
#import "Sizzle-Swift.h"
#endif
@implementation SizzleFXViewController {
SizzleDeviceAU *_au;
BOOL _built;
}
- (AUAudioUnit *)createAudioUnitWithComponentDescription:(AudioComponentDescription)desc error:(NSError **)error {
_au = [[[SizzleDeviceAU classForComponentType:desc.componentType] alloc]
initWithComponentDescription:desc options:0 error:error];
if (_au) dispatch_async(dispatch_get_main_queue(), ^{ [self buildIfReady]; });
return _au;
}
- (void)attachAudioUnit:(SizzleDeviceAU *)au {
_au = au;
[self buildIfReady];
}
- (void)viewDidLoad {
[super viewDidLoad];
self.preferredContentSize = CGSizeMake(560, 460);
self.view.backgroundColor = [UIColor colorWithRed:0.07 green:0.08 blue:0.09 alpha:1];
[self buildIfReady];
}
- (void)buildIfReady {
if (_built || !_au || !self.isViewLoaded) return;
_built = YES;
UIViewController *editor = [SizzleEditorFactory makeEditorFor:_au];
[self addChildViewController:editor];
editor.view.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:editor.view];
UILayoutGuide *g = self.view.safeAreaLayoutGuide;
[NSLayoutConstraint activateConstraints:@[
[editor.view.leadingAnchor constraintEqualToAnchor:g.leadingAnchor],
[editor.view.trailingAnchor constraintEqualToAnchor:g.trailingAnchor],
[editor.view.topAnchor constraintEqualToAnchor:g.topAnchor],
[editor.view.bottomAnchor constraintEqualToAnchor:g.bottomAnchor],
]];
[editor didMoveToParentViewController:self];
}
@end